2 JQuery tips

yast

New member
Jan 30, 2007
413
8
0
Need a fadeToggle method ?
add this to your jquery.js :

Code:
jQuery.fn.fadeToggle =  function(speed, easing, callback) {  
    return this.animate({opacity:  'toggle'}, speed, easing,  callback); 
};


blog.pengoworks.com/index.cfm/2008/2/6/jQuery-fadeToggle-plugin


need to use 2 libs at the same time ? (ie. jquery and lightbox)
api.jquery.com/jQuery.noConflict/

have fun
 


Need a fadeToggle method ?
add this to your jquery.js :

Code:
jQuery.fn.fadeToggle =  function(speed, easing, callback) {  
    return this.animate({opacity:  'toggle'}, speed, easing,  callback); 
};


blog.pengoworks.com/index.cfm/2008/2/6/jQuery-fadeToggle-plugin


need to use 2 libs at the same time ? (ie. jquery and lightbox)
api.jquery.com/jQuery.noConflict/

have fun

good ones, though I don't recommend tweaking the jquery core file. If you ever update your version, you'll lose that code and functionality.
 
That doesn't modify core jquery, that's how plugins are made. Just adds a method to the $ object.
 
I think he's talking about adding to the physical file vs putting it in a separate file and including it.

If you do it a lot, it's inevitable you will upgrade the core file and forget about the stuff you added to it 6 months ago. Then, you'll get mad at jquery because the new version broke your site and it will take several hrs for you to realize why it is not acting right.

I used to do things like this a lot.