views:

226

answers:

1

Hi

i used jquery many times in noconflict mode as below

var $j = jQuery.noConflict();

and it works great every time.

Today i used the jQuery 'before after' plugin. I used the same noconflict function but it did not work http://www.catchmyfame.com/2009/06/25/jquery-beforeafter-plugin/

I am not sure that $.fn.extend works with no conflict or not. Please help thanks

+2  A: 

Well, $.fn.extend will not work if it is within your code. You'll need to use $j.fn.extend for your code (if $j is the name of the variable that you are using for jQuery).

Plugins should work as they normally adopt the following convention,

(function($){ 
    /*Plugin Code*/
})(jQuery); 

which allows the use of $ whilst guaranteeing no conflict.

(See my answer here: http://stackoverflow.com/questions/2309614/what-does-this-javascript-jquery-syntax-mean/2309648#2309648)

I would check your plugin to see if this holds true.

Hope this helps

James Wiseman
The plug-in he linked does use aliasing and appears correct at first glance.
Nick Craver
Thanks James Wiseman i am using jquery UI as well in this plug-in and found there is some problem with jqueryUI http://dev.jquery.com/ticket/1686 . still things are not working :(
vipinsahu
That link suggests the problem si fixed. What version of jQuery are you using?
James Wiseman