1/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan 2 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 * jFlow 4 * Version: 1.1 (May 22, 2008) 5 * Requires: jQuery 1.2+ 6 */ 7 8//modified by LandRover 30th May 08 9 10(function($) { 11 12 $.fn.jFlow = function(options) { 13 var opts = $.extend({}, $.fn.jFlow.defaults, options); 14 var cur = 0; 15 var timer; 16 var selected_class = "jFlowSelected"; 17 var maxi = $(".jFlowControl").length; 18 $(this).find(".jFlowControl").each(function(i){ 19 $(this).click(function(){ 20 dotimer(); 21 22 $(".jFlowControl").removeClass(selected_class); 23 $(this).addClass(selected_class); 24 //alert(cur); 25 //alert(i); 26 var dur = Math.abs(cur-i); 27 $(opts.slides).animate({ 28 marginLeft: "-" + (i * $(opts.slides).find(":first-child").width() + "px") 29 }, opts.duration*(dur)); 30 cur = i; 31 }); 32 }); 33 34 $(opts.slides).before('<div id="jFlowSlide"></div>').appendTo("#jFlowSlide"); 35 36 $(opts.slides).find("div").each(function(){ 37 $(this).before('<div class="jFlowSlideContainer"></div>').appendTo($(this).prev()); 38 }); 39 40 //initialize the controller 41 $(".jFlowControl").eq(cur).addClass(selected_class); 42 43 var resize = function (x){ 44 $("#jFlowSlide").css({ 45 width: opts.width, 46 height: opts.height, 47 overflow: "hidden" 48 }); 49 50 $(opts.slides).css({ 51 width: $("#jFlowSlide").width()*$(".jFlowControl").length+"px", 52 height: $("#jFlowSlide").height()+"px", 53 overflow: "hidden" 54 }); 55 56 $(opts.slides).children().css({ 57 width: $("#jFlowSlide").width()+"px", 58 height: $("#jFlowSlide").height()+"px", 59 "float":"left" 60 }); 61 62 $(opts.slides).css({ 63 marginLeft: "-" + (cur * $(opts.slides).find(":first-child").width() + "px") 64 }); 65 } 66 67 resize(); 68 69 $(window).resize(function(){ 70 resize(); 71 }); 72 73 $(".jFlowPrev").click(function(){ 74 dotimer(); 75 doprev(); 76 }); 77 78 var doprev = function (x){ 79 if (cur > 0) 80 cur--; 81 else 82 cur = maxi -1; 83 84 $(".jFlowControl").removeClass(selected_class); 85 $(opts.slides).animate({ 86 marginLeft: "-" + (cur * $(opts.slides).find(":first-child").width() + "px") 87 }, opts.duration); 88 $(".jFlowControl").eq(cur).addClass(selected_class); 89 } 90 91 $(".jFlowNext").click(function(){ 92 donext(); 93 dotimer(); 94 }); 95 96 var donext = function (x){ 97 if (cur < maxi - 1) 98 cur++; 99 else 100 cur = 0; 101 102 $(".jFlowControl").removeClass(selected_class); 103 $(opts.slides).animate({ 104 marginLeft: "-" + (cur * $(opts.slides).find(":first-child").width() + "px") 105 }, opts.duration); 106 $(".jFlowControl").eq(cur).addClass(selected_class); 107 } 108 109 var dotimer = function (x){ 110 if(timer != null) 111 clearInterval(timer); 112 113 timer = setInterval(function() { 114 donext(); 115 }, opts.timer); 116 117 } 118 119 dotimer(); 120 }; 121 122 $.fn.jFlow.defaults = { 123 easing: "swing", 124 duration: 400, 125 width: "100%" 126 }; 127 128})(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.