1$(document).ready(function() { 2 var rotatorCarousel = $('.theRotator'); 3 if(typeof rotatorCarousel[0] != 'undefined'){ 4 rotatorCarousel.therotator(); 5 } 6}); 7 8(function($) 9{ 10 11 $.fn.therotator = function() 12 { 13 var rotatorDiv = this; 14 var rotatorElemParent = $('ul', rotatorDiv); 15 var rotatorElem = $('ul li', rotatorDiv); 16 var rotatorBtn = $('span.sidebutton a', rotatorDiv); 17 var rotatorIndBtn = $('p a', rotatorDiv); 18 var rotatorElemWidth = 230; 19 var rotatorElemCount = rotatorElem.length; 20 var rotatorTotalWidth = rotatorElemWidth*(rotatorElemCount-1); 21 var rotatorBtnClicked = false; 22 var rotationInterval = 8000; // in milliseconds 23 24 rotatorIndBtn.eq(1).addClass('selected'); 25 // console.log("Total Count ",$(rotatorElem).length); 26 $(rotatorElem).each(function(i) { 27 $(this).css('left', rotatorElemWidth*i).attr('data-idx', i); 28 }); 29 30 function clickFunction(obj) 31 { 32 clearInterval(cacheIntrvl); 33 if(obj.parent().index()==2) { startRotator('right'); } 34 else { startRotator('left'); } 35 cacheIntrvl = setInterval(function(){ startRotator('left'); }, rotationInterval); 36 } 37 38 var startRotator = function(direction) 39 { 40 rotatorBtn.unbind('click'); 41 42 if(direction == 'left') 43 { 44 $(rotatorElem).each(function(i) 45 { 46 newPositionVal = ($(this).index() * rotatorElemWidth) - rotatorElemWidth; 47 if(newPositionVal == rotatorElemWidth) { setSelection($(this).attr('data-idx')); } 48 $(this).stop(true, false).animate({left : newPositionVal }, 500, function() 49 { 50 if($(this).position().left < 0) 51 { 52 $(this).css('left', (rotatorElemCount-1)*rotatorElemWidth) 53 var detachedElem = $(this).detach(); 54 rotatorElemParent.append(detachedElem); 55 } 56 if(i== (rotatorElemCount-1)) 57 { 58 rotatorBtn.bind('click', function() 59 { 60 clickFunction($(this)); 61 }); 62 } 63 }); 64 65 }); 66 67 } 68 else 69 { 70 var detachedElem = $('ul li', rotatorDiv).eq(rotatorElemCount-1).detach(); 71 rotatorElemParent.prepend(detachedElem); 72 detachedElem.css('left', -rotatorElemWidth) 73 $(rotatorElem).each(function(i) 74 { 75 newPositionVal = ($(this).index() * rotatorElemWidth); 76 if(newPositionVal == rotatorElemWidth) { setSelection($(this).attr('data-idx')); } 77 $(this).stop(true, false).animate({left : newPositionVal}, 500, function() 78 { 79 if(i== (rotatorElemCount-1)) 80 { 81 rotatorBtn.bind('click', function() 82 { 83 clickFunction($(this)); 84 }); 85 } 86 }); 87 }); 88 } 89 } 90 91 var cacheIntrvl = setInterval(function(){ startRotator('left'); }, rotationInterval); 92 93 rotatorBtn.bind('click', function() 94 { 95 clickFunction($(this)); 96 }); 97 98 var setSelection = function(idx) 99 { 100 rotatorIndBtn.removeClass('selected').eq(idx).addClass('selected'); 101 } 102 103 rotatorIndBtn.on('click', function(e) { 104 e.preventDefault(); 105 }); 106 } 107 108})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.