Hi Guys,
I'm struggling with some jQuery code. I don't understand how to make my code work without using the $ shortcut. Maybe someone here can help?
var autoTimerId = -1;
jQuery(document).ready(function($) {
$("#rotate > div:eq(1) > a").click(function(){rotate()});
$("#rotate").hover(function() {$("#rotate > div:eq(1) > a > img").show();clearInterval(autoTimerId)}, function() {$("#rotate > div:eq(1) > a > img").hide();clearInterval(autoTimerId);autoTimerId = setInterval("rotate()", 5000)});
autoTimerId = setInterval("rotate()", 5000);
$("#rotate > div:eq(1) > a > img").mousedown(function(){$("#rotate > div:eq(1) > a > img").attr({src : "img/arrow_down.png"})}).mouseup(function(){$("#rotate > div:eq(1) > a > img").attr({src : "img/arrow_over.png"})});
$("#rotate > div:eq(1) > a > img").hide();
});
function rotate(){
//rotate right list
$("#rotate > div:eq(1) > ul > li:last").insertBefore("#rotate > div:eq(1) > ul > li:first");
$("#rotate > div:eq(1) > ul").css("top","-100px").animate({top:"0px"},500);
//crossfade left image
if ($('div.fade > div').is(':animated')) {
$('div.fade > div').stop().fadeTo(250, 1, function(){setUpNextImgForCrossFade()});
} else {
$('div.fade > div').fadeIn(250, function(){setUpNextImgForCrossFade()});
}
}
function setUpNextImgForCrossFade(){
$('div.fade > a > img').attr('src', $("#rotate > div:eq(1) > ul > li:eq(3) > a > img").attr('src'));
$('div.fade > a').attr('href', $("#rotate > div:eq(1) > ul > li:eq(3) > a").attr('href'));
$('div.fade > div').hide();
$('div.fade > div > a > img').attr('src', $("#rotate > div:eq(1) > ul > li:eq(2) > a > img").attr('src'));
$('div.fade > div > a').attr('href', $("#rotate > div:eq(1) > ul > li:eq(2) > a").attr('href'));
}
Thanks!