1(function () { var jQuery = this.template_ugly_jquery; var $ = this.template_ugly_jquery; 2 3 4 5/** 6 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget. 7 * @requires jQuery v1.2 or above 8 * 9 * http://gmarwaha.com/jquery/jcarousellite/ 10 * 11 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) 12 * Dual licensed under the MIT and GPL licenses: 13 * http://www.opensource.org/licenses/mit-license.php 14 * http://www.gnu.org/licenses/gpl.html 15 * 16 * Version: 1.0.1 17 * Note: Requires jquery 1.2 or above from version 1.0.1 18 **/ 19 20/** 21* Creates a carousel-style navigation widget for images/any-content from a simple HTML markup. 22* 23* The HTML markup that is used to build the carousel can be as simple as... 24* 25* <div class="carousel"> 26* <ul> 27* <li><img src="image/1.jpg" alt="1"></li> 28* <li><img src="image/2.jpg" alt="2"></li> 29* <li><img src="image/3.jpg" alt="3"></li> 30* </ul> 31* </div> 32* 33* As you can see, this snippet is nothing but a simple div containing an unordered list of images. 34* You don't need any special "class" attribute, or a special "css" file for this plugin. 35* I am using a class attribute just for the sake of explanation here. 36* 37* To navigate the elements of the carousel, you need some kind of navigation buttons. 38* For example, you will need a "previous" button to go backward, and a "next" button to go forward. 39* This need not be part of the carousel "div" itself. It can be any element in your page. 40* Lets assume that the following elements in your document can be used as next, and prev buttons... 41* 42* <button class="prev"><<</button> 43* <button class="next">>></button> 44* 45* Now, all you need to do is call the carousel component on the div element that represents it, and pass in the 46* navigation buttons as options. 47* 48* $(".carousel").jCarouselLite({ 49* btnNext: ".next", 50* btnPrev: ".prev" 51* }); 52* 53* That's it, you would have now converted your raw div, into a magnificient carousel. 54* 55* There are quite a few other options that you can use to customize it though. 56* Each will be explained with an example below. 57* 58* @param an options object - You can specify all the options shown below as an options object param. 59* 60* @option btnPrev, btnNext : string - no defaults 61* @example 62* $(".carousel").jCarouselLite({ 63* btnNext: ".next", 64* btnPrev: ".prev" 65* }); 66* @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward. 67* 68* @option btnGo - array - no defaults 69* @example 70* $(".carousel").jCarouselLite({ 71* btnNext: ".next", 72* btnPrev: ".prev", 73* btnGo: [".0", ".1", ".2"] 74* }); 75* @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on 76* the item number within the carousel, you can use this option. Just supply an array of selectors for each element 77* in the carousel. The index of the array represents the index of the element. What i mean is, if the 78* first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel 79* will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed 80* interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding 81* any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin. 82* The best part is that, the tab will "slide" based on the provided effect. :-) 83* 84* @option mouseWheel : boolean - default is false 85* @example 86* $(".carousel").jCarouselLite({ 87* mouseWheel: true 88* }); 89* @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons. 90* To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon. 91* Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel 92* using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation 93* as well. They complement each other. To use both together, just supply the options required for both as shown below. 94* @example 95* $(".carousel").jCarouselLite({ 96* btnNext: ".next", 97* btnPrev: ".prev", 98* mouseWheel: true 99* }); 100* 101* @option auto : number - default is null, meaning autoscroll is disabled by default 102* @example 103* $(".carousel").jCarouselLite({ 104* auto: 800, 105* speed: 500 106* }); 107* @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option. 108* The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling. 109* Specify this value and magically your carousel will start auto scrolling. 110* 111* @option speed : number - 200 is default 112* @example 113* $(".carousel").jCarouselLite({ 114* btnNext: ".next", 115* btnPrev: ".prev",
116* speed: 800 117* }); 118* @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with 119* different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect. 120* 121* @option easing : string - no easing effects by default. 122* @example 123* $(".carousel").jCarouselLite({ 124* btnNext: ".next", 125* btnPrev: ".prev", 126* easing: "bounceout" 127* }); 128* @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified, 129* the carousel will slide based on the provided easing effect. 130* 131* @option vertical : boolean - default is false 132* @example 133* $(".carousel").jCarouselLite({ 134* btnNext: ".next", 135* btnPrev: ".prev", 136* vertical: true 137* }); 138* @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and 139* prev buttons will slide the items vertically as well. The default is false, which means that the carousel will 140* display horizontally. The next and prev items will slide the items from left-right in this case. 141* 142* @option circular : boolean - default is true 143* @example 144* $(".carousel").jCarouselLite({ 145* btnNext: ".next", 146* btnPrev: ".prev", 147* circular: false 148* }); 149* @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last 150* element, you will automatically slide to the first element and vice versa. If you set circular to false, then 151* if you click on the "next" button after you reach the last element, you will stay in the last element itself 152* and similarly for "previous" button and first element. 153* 154* @option visible : number - default is 3 155* @example 156* $(".carousel").jCarouselLite({ 157* btnNext: ".next", 158* btnPrev: ".prev", 159* visible: 4 160* }); 161* @desc This specifies the number of items visible at all times within the carousel. The default is 3. 162* You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the 163* last item half visible. This gives you the effect of showing the user that there are more images to the right. 164* 165* @option start : number - default is 0 166* @example 167* $(".carousel").jCarouselLite({ 168* btnNext: ".next", 169* btnPrev: ".prev", 170* start: 2 171* }); 172* @desc You can specify from which item the carousel should start. Remember, the first item in the carousel 173* has a start of 0, and so on. 174* 175* @option scrool : number - default is 1 176* @example 177* $(".carousel").jCarouselLite({ 178* btnNext: ".next", 179* btnPrev: ".prev", 180* scroll: 2 181* }); 182* @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By 183* default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll 184* 2 items when you click the next or previous buttons. 185*
186* @option beforeStart, afterEnd : function - callbacks 187* @example 188* $(".carousel").jCarouselLite({ 189* btnNext: ".next", 190* btnPrev: ".prev", 191* beforeStart: function(a) { 192* alert("Before animation starts:" + a); 193* }, 194* afterEnd: function(a) { 195* alert("After animation ends:" + a); 196* } 197* }); 198* @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can 199* register these 2 callbacks. The functions will be passed an argument that represents an array of elements that 200* are visible at the time of callback. 201* 202* 203* @cat Plugins/Image Gallery 204* @author Ganeshji Marwaha/[email protected] 205**/ 206 207(function($) { // Compliant with jquery.noConflict() 208 $.fn.jCarouselLite = function(o) { 209 o = $.extend({ 210 btnPrev: null, 211 btnNext: null, 212 btnGo: null, 213 mouseWheel: false, 214 auto: null, 215 216 speed: 200, 217 easing: null, 218 219 vertical: false, 220 circular: true, 221 visible: 1, 222 start: 0, 223 scroll: 1, 224 225 beforeStart: null, 226 afterEnd: null 227 }, o || {}); 228 229 return this.each(function() { // Returns the element collection. Chainable. 230 231 var running = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width"; 232 var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; 233 234 if (o.circular) { 235 ul.prepend(tLi.slice(tl - v - 1 + 1).clone()) 236 .append(tLi.slice(0, v).clone()); 237 o.start += v; 238 } 239 240 var li = $("li", ul), itemLength = li.size(), curr = o.start; 241 242 $(".bt1").addClass("current"); //JBarlow// Sets external control highlight to slide in current position at start 243 div.css("visibility", "visible"); 244 245 li.css({ overflow: "hidden", float: o.vertical ? "none" : "left" }); 246 ul.css({ margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" }); 247 div.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "0px" }); 248 249 var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation 250 var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items) 251 var divSize = liSize * v; // size of entire div(total length for just the visible items) 252 253 li.css({ width: li.width(), height: li.height() }); 254 ul.css(sizeCss, ulSize + "px").css(animCss, -(curr * liSize)); 255 256 div.css(sizeCss, divSize + "px");
256 // Width of the DIV. length of visible images 257 258 if (o.btnPrev) 259 $(o.btnPrev).click(function() { 260 return go(curr - o.scroll); 261 }); 262 263 if (o.btnNext) 264 $(o.btnNext).click(function() { 265 return go(curr + o.scroll); 266 }); 267 268 if (o.btnGo) 269 $.each(o.btnGo, function(i, val) { 270 $(val).click(function() { 271 $("#featured-controls li").removeClass("current"); //JBarlow// Remove active class from all external control buttons 272 $(this).addClass("current"); //JBarlow// Add active class to current button 273 running = false; 274 return go(o.circular ? o.visible + i : i); 275 }); 276 }); 277 278 if (o.mouseWheel && div.mousewheel) 279 div.mousewheel(function(e, d) { 280 return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll); 281 }); 282 283 //If the Pause option is set, toggle the paused class for the selector given 284 285 if (o.pause) { 286 $("#CarouselPlayPause").click(function() { 287 if ($("#CarouselPlayPause").hasClass("paused")) { 288 $(o.pause).removeClass("paused"); 289 } 290 else { 291 $(o.pause).addClass("paused"); 292 } 293 }); 294 295 } 296 297 if (o.auto) 298 setInterval(function() { 299 running = checkIfPaused(o); 300 go(curr + o.scroll); 301 302 }, o.auto + o.speed); 303 304 function vis() { 305 return li.slice(curr).slice(0, v); 306 }; 307 308 //Check to see if the Animation has been paused or not 309 310 function checkIfPaused(o) { 311 312 if ($(o.pause).hasClass("paused")) { 313 return true; 314 } 315 else { 316 return false; 317 } 318 }; 319 320 function go(to) { 321 if (!running) { 322 if (o.beforeStart) { 323 o.beforeStart.call(this, vis()); 324 } 325 if (o.circular) { // If circular we are in first or last, then goto the other end 326 if (to <= o.start - v - 1) { // If first, then goto last 327 ul.css(animCss, -((itemLength - (v * 2)) * liSize) + "px"); // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements. 328 curr = to == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll; 329 } else if (to >= itemLength - v + 1) { // If last, then goto first 330 ul.css(animCss, -((v) * liSize) + "px"); // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements. 331 curr = to == itemLength - v + 1 ? v + 1 : v + o.scroll; 332 } else { 333 curr = to; 334 } 335 } else { // If non-circular and to points to first or last, we just return. 336 if (to < 0 || to > itemLength - v) { 337 return; 338 } 339 else { 340 curr = to; 341 } 342 } // If neither overrides it, the curr will still be "to" and we can proceed. 343 running = true; 344 345 ul.animate( 346 animCss == "left" ? { left: -(curr * liSize)} : { top: -(curr * liSize) }, o.speed, o.easing, 347 function() { 348 if (o.afterEnd) 349 o.afterEnd.call(this, vis()); 350 running = false;
351 } 352 ); 353 354 if (to > tl) { 355 $("#featured-controls li").removeClass("current"); //JBarlow// Remove active class from all external control buttons 356 $(".bt" + (to - tl)).addClass("current"); //JBarlow// Add active class to current button 357 } 358 else { 359 $("#featured-controls li").removeClass("current"); //JBarlow// Remove active class from all external control buttons 360 $(".bt" + to).addClass("current"); //JBarlow// Add active class to current button 361 } 362 363 // Disable buttons when the carousel reaches the last/first, and enable when not 364 if (!o.circular) { 365 $(o.btnPrev + "," + o.btnNext).removeClass("disabled"); 366 $((curr - o.scroll < 0 && o.btnPrev) 367 || 368 (curr + o.scroll > itemLength - v && o.btnNext) 369 || 370 [] 371 ).addClass("disabled"); 372 } 373 } 374 return false; 375 }; 376 }); 377 }; 378 379 380 381 function css(el, prop) { 382 return parseInt($.css(el[0], prop)) || 0; 383 }; 384 function width(el) { 385 return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight'); 386 }; 387 function height(el) { 388 return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom'); 389 }; 390 391})(jQuery); 392 393 394 395}.bind(this))()
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.