Hi, can someone help me to fix the conflict between jQuery and Mootools?
I'm using jQuery 1.7.2 on my website which is under develepment. But since I started using mootools.1.2.js the carousel stopped working.
Here is the carousel's script.
Code:
var OpenArticleOnClickInactive = true;
var OpenArticleOnClickActive = true;
/* Transition Options */
var DisableTransitions = false;
var ImageTransitionOnPagingControls = false;
var ImageTransitionOnNavSelect = false;
var ImageTransitionSpeed = 750;
var TitleTransitionSpeed = 500;
var TitleTransitionOnPaging = true;
var Highlights; var TransitionTimer; var BubbleTimer;
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};
function HPHLObject(){this.title = null;this.subtitle = null;this.image = null;this.url = null;this.duration = 6;};
$('document').ready(function(){
Highlights = new HPHL();
$('#HPHLNav ul li p').each(function(ind,val){$(this).css('top',(parseInt(64-$(this).innerHeight())*.5)-2+'px')});
Highlights.Init(); $('#HPHLCurrent').on('click',function(){location.href = Highlights.GetContent()[Highlights.GetCurrentIndex()].url});
$('#HPHLPrev').on('click',function(){Highlights.Prev();});$('#HPHLNext').on('click',function(){Highlights.Next();});
if(!OpenArticleOnClickInactive){$('#HPHLNav ul li a').click(function(e){e.preventDefault();Highlights.Clicked(e);});}
});
function HPHL(){
var that = this; var contents = new Array();
var total = function(){return $('#HPHLNav ul li').size();};
var nextI = function(){return (currentI() == (total()-1)) ? 0 : currentI() + 1;}
var prevI = function(){return (currentI() == 0) ? total() - 1 : currentI() - 1;}
var currentI = function(){return $('#HPHLNav ul li.Active').index();}
this.Init=function(){
$('#HPHLNav ul li').each(function(i,e){
var obj = new HPHLObject(); var Img = $(e).find('img');
obj.duration = parseInt(RegExp(/Duration_([0-9]+)/).exec($(this).attr('class')).pop());
obj.title = $(e).text().trim(); obj.url = $(e).find('a').attr('href');
obj.subtitle = $(e).find('a').attr('title'); obj.alt = $(Img).attr('alt');
obj.src = $(Img).attr('src'); contents.push(obj);})
Ni = nextI(); that.SetTimer(contents[Ni].duration,Ni);}
this.GetContent = function(){return contents;}
this.GetTotal = function(){return total();}
this.GetCurrentIndex = function(){return currentI();}
this.GetNextIndex = function(){return nextI();}
this.GetPrevIndex = function(){return prevI();}
this.GetCurrentDuration = function(){return contents[currentI()].duration;}
this.Next = function(){return (ImageTransitionOnPagingControls) ? that.Transition(nextI()) : that.Switch(nextI());}
this.Prev = function(){return (ImageTransitionOnPagingControls) ? that.Transition(prevI()) : that.Switch(prevI());}
this.Clicked = function(e){var curI = Highlights.GetCurrentIndex(); var clkI = $($(e.currentTarget).parentsUntil('li').parent()).index();
return (clkI == curI && OpenArticleOnClickActive)
? location.href = that.GetContent()[curI].url
: (ImageTransitionOnNavSelect ? that.Transition(clkI) : that.Switch(clkI));}
this.Transition=function(i){
if(DisableTransitions) return that.Switch(i);
var iSpeed = ImageTransitionSpeed ? ImageTransitionSpeed : 'slow';
var tSpeed = TitleTransitionSpeed ? TitleTransitionSpeed : 'medium';
clearTimeout(BubbleTimer);
BubbleTimer = setTimeout(function(){
$('#MarqueeText').animate({opacity: 0},25,function(){
$(this).animate({top:'30px'},25,function(){
$('#MarqueeText .HPHLSubtext').hide();
$('#MarqueeText a').attr('title',contents[i].subtitle).attr('href',contents[i].url).html(contents[i].title);
$('#MarqueeText .HPHLSubtext').html(contents[i].subtitle);
$('#MarqueeText .HPHLSubtext').fadeIn(tSpeed,'swing');});
$(this).animate({top: '0px', opacity: 1},250,'swing');});},200);
$('#HPHLCurrent a').attr('title',contents[i].alt);
$('#HPHLCurrent a').attr('href',contents[i].url);
$('<img class="HPHLImage" alt="' + contents[i].alt + '" src="' + contents[i].src + '" />').insertBefore('#HPHLCurrent .HPHLImage:first-child');
$('#HPHLCurrent .HPHLImage:not(:first-child)').fadeTo(iSpeed,0,function(){
$('#HPHLCurrent .HPHLImage:not(:first-child)').remove();});
$('#HPHLNav ul li.Active').removeClass('Active'); $($('#HPHLNav ul li').get(i)).addClass('Active');
Ni = nextI(); that.SetTimer(contents[Ni].duration,Ni);}
this.Switch = function(i){
$('#HPHLCurrent a').attr('title',contents[i].alt).attr('href',contents[i].url);
$('#HPHLCurrent .HPHLImage').attr('alt',contents[i].alt).attr('src',contents[i].src);
$('#MarqueeText a').attr('alt',contents[i].alt).attr('href',contents[i].url).html(contents[i].title);
$('#MarqueeText .HPHLSubtext').html(contents[i].subtitle);
$('#HPHLNav ul li.Active').removeClass('Active'); $($('#HPHLNav ul li').get(i)).addClass('Active');
Ni = nextI(); that.SetTimer(contents[Ni].duration,Ni);}
this.SetTimer = function(seconds,itemIndex){clearTimeout(TransitionTimer); TransitionTimer=setTimeout('Highlights.' + (DisableTransitions ? 'Switch' : 'Transition') + '('+itemIndex+')',(seconds*1000));}}
Bookmarks