jQuery

Fix missing body images when site moved in subdirectory
/**
 * When site move to subdirectory, pictures, added in WYSIWYG, return old address
 * this small js fix it.
 */

(function($){
  $(document).ready(function() {
  
    if (Drupal.settings.basePath != '/') {
      $("body.page-node article .entry-content img").each(function() {
        var src = $(this).attr('src');
        $(this).attr('src', Drupal.settings.basePath + src);
      });
    }
  });
})(jQuery.noConflict());
Simple js/jQuery calculator creation

In some cases we need to create some kind of online calculator without sending information to server. There are a lot of plugins but they are usefull only if we need to make serious calculations in simple cases we can use our brain and jQuery api. Code given below consist of two parts: html and js.

So html we need given below:

10 out of 10 based on 2 ratings.
Read more
How to make menu element non clickable

Sometimes we need to make some menu items non clickable, there are some modules in drupal wich can make it , but installing module is not the easiest solution. Couple js lines given below is easiest way as i think. This way is the best when we have dropdown menu with a lot of items in different levels, only in this case our solution is very suitable. Here is code:

5.25 out of 10 based on 32 ratings.
Read more
How to add jQuery.noConflict() to js file

Sometimes we are using different names of main jQuery function, i mean $ and jQuery. Finally it causes some errors with js code due to name differenses. we can prevent it using this construction jQuery.noConflict(). I will show in details how we should do it.