How to use multiple jQuery Plugins in one File
How to use multiple jQuery Plugins in one File? I have to use jCarousel and Lightbox plugin both together in a file of php. the jCarousel is working fine for the light box all paths are correct but it always says that
$("#gallery a").lightbox is not a function.
Same as for fancy box or how do I can use Lightbox2 of prototype with jQuery.
I used the below for no confliction
var $jx = jQuery.noConflict();
$jx(function() {
$jx(".jgallery").jCarouselLite({
btnNext: ".morePost",
visible: 8,
scroll:8
});
for usi开发者_C百科ng with prototype. The Prototype Light Box Start working but jCarousel does not work after this.
Allow me to suggest a different alternative here. If you're including Prototype just for the lightgox, don't :)
There's a jQuery version of the lightbox plugin, this will save you the weight on the user's download of 1/2 libraries. Just use the jQuery version here: http://avioli.github.io/jquery-lightbox/
There are a few variations out there, but no need to include 2 major JavaScript libraries that share similar plugins, just choose one and use the version of plugins that are built on it.
You can use a compiler to combine all your javascripts in one file. Famous ones are
- closure by google
- yui compresser by yahoo
Select your poison of choice. There are others you may want to investigate, even open source solutions that you can embed in your projects
精彩评论