PDA

View Full Version : Step Carousel does not work with noConflict



kenw232
11-14-2008, 11:43 PM
1) Script Title:
Step Carousel Viewer v1.6.1

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm

3) Describe problem:
When I use JQuery's noconflict() I get a javascript error with Step Carousel Viewer v1.6.1. I have to do a jQuery.noConflict(); to fix conflicting issue with other scripts (like using prototype.js at the same time).

For example this causes a javascript error and stops the carousel from working (the right/left arrows don't show to scroll through the images):
<script type="text/javascript" src="scripts/jquery126.js"></script>
<script type="text/javascript"> var $j = jQuery.noConflict(); </script>
<script type="text/javascript" src="scripts/stepcarousel.js"></script>

Removing "<script type="text/javascript"> var $j = jQuery.noConflict(); </script>" would fix it.

Please help
kenw232@yahoo.com

ddadmin
11-15-2008, 09:40 AM
Having called $j = jQuery.noConflict(), the fastest way to complete the change is to open up stepcarousel.js, and do a search and replace of all instances of "$" with "$j" instead.

Kozawa
06-12-2009, 03:01 AM
I just added 2 lines to step carousel v1.6.1 and worked fine with jQuery.noConflict().


addnavbuttons:function(config, currentpanel){
(function ($){ // Added for noConflict()
config.$leftnavbutton=$('<img src="'+config.defaultbuttons.leftnav[0]+'">').css({zIndex:50, position:'absolute', left:config.offsets.left+config.defaultbuttons.leftnav[1]+'px', top:config.offsets.top+config.defaultbuttons.leftnav[2]+'px', cursor:'hand', cursor:'pointer'}).attr({title:'Back '+config.defaultbuttons.moveby+' panels'}).appendTo('body')
config.$rightnavbutton=$('<img src="'+config.defaultbuttons.rightnav[0]+'">').css({zIndex:50, position:'absolute', left:config.offsets.left+config.$gallery.get(0).offsetWidth+config.defaultbuttons.rightnav[1]+'px', top:config.offsets.top+config.defaultbuttons.rightnav[2]+'px', cursor:'hand', cursor:'pointer'}).attr({title:'Forward '+config.defaultbuttons.moveby+' panels'}).appendTo('body')
config.$leftnavbutton.bind('click', function(){ //assign nav button event handlers
stepcarousel.stepBy(config.galleryid, -config.defaultbuttons.moveby)
})
config.$rightnavbutton.bind('click', function(){ //assign nav button event handlers
stepcarousel.stepBy(config.galleryid, config.defaultbuttons.moveby)
})
if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
this.fadebuttons(config, currentpanel)
}
return config.$leftnavbutton.add(config.$rightnavbutton)
})(jQuery); // Added for noConflict()
},

ptejera
06-19-2009, 01:55 PM
If only I would have come to the forums 2 hours earlier today! Thanks Kozawa for the fix!