I've new to JQuery schematics but good with JQuery plugin implementation, until today. The problem is I had one working text transition script on the page. I added a second JQuery plugin on the same page, and it failed to work. But it works perfectly on a demo page I created before integration into this page.
I have a feeling the problem lies either with a function or variable having the same name, but the blocks won't hide on page load... so... here are the two scripts as they appear on my page. Hopefully you can spot the problem.
First the header links incase there is a conflict here...
Code:
<link rel="stylesheet" type="text/css" href="css/jqfade.css" /> <!-- styles for JQuery text fade -->
<script type="text/javascript" src="scripts/jquery.js"></script> <!-- script for JQuery text fade -->
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" /> <!-- Mootools Stylesheet -->
<script type="text/javascript" src="scripts/mootools-1.2-core.js"></script> <!-- Mootools -->
<script type="text/javascript" src="scripts/class.noobSlide.packed.js"></script> <!-- Mootools plugin -->
And the JQuery plugin code in the header...
Code:
<script type="text/javascript">
window.addEvent('domready',function(){
//Active Testimonials
var handles8_more = $$('#handles8_more span');
var nS8 = new noobSlide({
box: $('box8'),
items: $$('#box8 h3'),
size: 480,
handles: $$('#handles8 span'),
// addButtons: {previous: $('prev8'), play: $('play8'), stop: $('stop8'), playback: $('playback8'), next: $('next8') },
autoPlay: true,
onWalk: function(currentItem,currentHandle){
//style for handles
$$(this.handles,handles8_more).removeClass('active');
$$(currentHandle,handles8_more[this.currentIndex]).addClass('active');
//text for "previous" and "next" default buttons
// $('prev8').set('html','<< '+this.items[this.previousIndex].innerHTML); // remove to add buttons
// $('next8').set('html',this.items[this.nextIndex].innerHTML+' >>'); // remove to add buttons
}
});
//more "previous" and "next" buttons
nS8.addActionButtons('previous',$$('#box8 .prev'));
nS8.addActionButtons('next',$$('#box8 .next'));
//more handle buttons
nS8.addHandleButtons(handles8_more);
//walk to item 3 witouth fx
nS8.walk(3,false,true);
});
</script>
<script type="text/javascript">
(function ($) {
$.fn.fadeTransition = function(options) {
var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);
var transitionObject;
Trans = function(obj) {
var timer = null;
var switched = 0;
var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
$(obj).css("position", "relative");
$(els[current]).css("display", "block");
function transition(next) {
$(els[current]).fadeOut(options.transitionTime);
$(els[next]).fadeIn(options.transitionTime);
current = next;
cue();
};
function cue() {
if ($("> *", obj).length < 2) return false;
if (timer) clearTimeout(timer);
timer = setTimeout(function() { transition((current + 1) % els.length | 0)} , options.pauseTime);
};
this.showItem = function(item) {
if (timer) clearTimeout(timer);
transition(item);
};
cue();
}
this.showItem = function(item) {
transitionObject.showItem(item);
};
return this.each(function() {
transitionObject = new Trans(this);
});
}
})(jQuery);
var page = {
tr: null,
init: function() {
page.tr = $(".area").fadeTransition({pauseTime: 7000, transitionTime: 2000});
$("div.navigation").each(function() {
$(this).children().each( function(idx) {
if ($(this).is("a"))
$(this).click(function() { page.tr.showItem(idx); return false; })
});
});
},
show: function(idx) {
if (page.tr.timer) clearTimeout(page.tr.timer);
page.tr.showItem(idx);
}
};
$(document).ready(page.init);
</script>
ps. I did some extra checks, and found that when I deleted portions of the scripts, the problem lies in
Code:
<script type="text/javascript" src="scripts/mootools-1.2-core.js"></script> <!-- Mootools -->
Bookmarks