PDA

View Full Version : jquery slideshow javascript marquee not working on same page



shocolin
04-15-2012, 10:21 AM
Hello
I have a marquee on my page with this code:


<script type="text/javascript" src="marquee/scroll.js"></script>
<script type="text/javascript">
(function(){

window.addEvent('domready',function(){
var jvnewintro = $$('.scroll-intro')[0];
if(!jvnewintro) return;
jvnewintro.setStyle('overflow','hidden');
var
fx = new Fx.Scroll(jvnewintro),
delay = 3000
;
var step = function(){
setTimeout(function(){
var toTop = jvnewintro.scrollTop + 50;
if(toTop >= jvnewintro.scrollHeight - jvnewintro.getStyle('height').toInt() + 50) toTop = 0;
fx.scrollTo(0,toTop).chain(function(){
step();
});
},delay);
}
step();
});

})();
</script>


and then i have a slideshow with this code:


<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.slideshow.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$('#slideshow').slideshow({
timeout: 5000,
type: 'sequence',
pauselink: 'pause1',
pausecallback: function(self){
self.html('Play')
},
playcallback: function(self){
self.html('Pause');
}
});

});
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>


when i put them together, only the one that is first works, no matter which one it is.
How can i make them both work together on the page ? I am searching for the answer but can't seem to find exactly what i need.
please help thanks.

jscheuer1
04-15-2012, 02:43 PM
new Fx.Scroll

implies that you are using MooTools on the page, so you left something out from your post - a script tag for the MooTools script library. It probably comes before:



<script type="text/javascript" src="marquee/scroll.js"></script>

What you can do is place the second code block first, before the MooTools tag and edit it to look like so:


<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.slideshow.min.js"></script>

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($) {
$('#slideshow').slideshow({
timeout: 5000,
type: 'sequence',
pauselink: 'pause1',
pausecallback: function(self){
self.html('Play')
},
playcallback: function(self){
self.html('Pause');
}
});

});
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>

As long as jquery.slideshow.min.js is written in such a way that it can operate in noConflict mode, that will work. Both scripts should now function.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.