Best JQuery noConflict method


There is some ways to resolving conflicts with other javascript libraries but i will show you most effective method to using multiple java script or jQuery codes in same page

let’s assume that you have some codes like this

 

<script type='text/javascript'> 

  $(function() {
  $('#somthing').css;
  $('.somthing');
  });
</script>

 

Changing code above with following code help using scripts without any problem

 

<script type='text/javascript'>
jQuery.noConflict();
jQuery(document).ready(function($) {
  $('#floatingbar').css({height: 0}).animate({ height: '38' }, 'slow');
  $('.toolbarLink').tipsy({gravity: 's'});
  });
</script>

 

so mainly we should add jQuery.noConflict(); and change $(function() { to

jQuery(document).ready(function($) {

that’s all.

 

Leave a Reply

Your email address will not be published. Required fields are marked *