namibia
90d6a07e7e4539815d3e24e48c81d37282fb4e71
namibia / public / js / vendor / jquery.anythingslider.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
/* AnythingSlider v1.4.6 By Chris Coyier: http://css-tricks.com with major improvements by Doug Neiner: http://pixelgraphics.us/ based on work by Remy Sharp: http://jqueryfordesigners.com/ To use the navigationFormatter function, you must have a function that accepts two paramaters, and returns a string of HTML text. index = integer index (1 based); panel = jQuery wrapped LI item this tab references @return = Must return a string of HTML/Text navigationFormatter: function(index, panel){ return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index } */ (function($) { $.anythingSlider = function(el, options) { // To avoid scope issues, use 'base' instead of 'this' // to reference this class from internal events and functions. var base = this; // Wraps the ul in the necessary divs and then gives Access to jQuery element base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>'); // Add a reverse reference to the DOM object base.$el.data("AnythingSlider", base); base.init = function(){ base.options = $.extend({}, $.anythingSlider.defaults, options); // Cache existing DOM elements for later // base.$el = original ul // for wrap - get parent() then closest in case the ul has "anythingSlider" class base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + base.options.theme); base.$window = base.$el.closest('div.anythingWindow'); base.$controls = $('<div class="anythingControls"></div>').appendTo(base.$wrapper); base.$items = base.$el.find('> li').addClass('panel'); // Set up a few defaults & get details base.pages = base.$items.length; base.timer = null; // slideshow timer (setInterval) container base.flag = false; // event flag to prevent multiple calls (used in control click/focusin) base.playing = false; // slideshow state base.hovered = false; // actively hovering over the slider base.panelSize = []; // will contain dimensions and left position of each panel base.currentPage = base.options.startPanel; base.hasEmb = !!base.$items.find('embed[src*=youtube]').length; // embedded youtube objects exist in the slider base.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && $.isFunction(swfobject.embedSWF)) ? true : false; // is swfobject loaded? // Get index (run time) of this slider on the page base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1; // Make sure easing function exists. if (!$.isFunction($.easing[base.options.easing])) { base.options.easing = "swing"; } // Add theme stylesheet, if it isn't already loaded if (base.options.theme != 'default' && !$('link[href*=' + base.options.theme + ']').length){ $('body').append('<link rel="stylesheet" href="' + base.options.themeDirectory.replace(/\{themeName\}/g, base.options.theme) + '" type="text/css" />'); } // Initialize YouTube javascript api, if YouTube video is present if (base.hasEmb && base.hasSwfo) { base.$items.find('embed[src*=youtube]').each(function(i){ // Older IE doesn't have an object - just make sure we are wrapping the correct element var $tar = ($(this).parent()[0].tagName == "OBJECT") ? $(this).parent() : $(this); $tar.wrap('<div id="ytvideo' + i + '"></div>'); // use SWFObject if it exists, it replaces the wrapper with the object/embed swfobject.embedSWF($(this).attr('src') + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i, 'ytvideo' + i, '100%', '100%', '10', null, null, { allowScriptAccess: "always", wmode : base.options.addWmodeToObject }, {}); }); } /***** Consider removing this portion completely, if users will use SWFObject ***** // This commented out code will allow YouTube API functions to work for non-IE browsers else if (base.hasEmb) { // initialize youtube api when swf isn't loaded - doesn't work in IE (even if you find('embed')) base.$items.find('object').each(function(i){ if ($(this).find('[src*=youtube]').length){ $(this) .prepend('<param name="wmode" value="' + base.options.addWmodeToObject +'"/>') .wrap('<div id="yt-temp"></div>') .find('embed[src*=youtube]').attr('src', function(j,s){ return s + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i; }) .attr('wmode',base.options.addWmodeToObject).end() .find('param[value*=youtube]').attr('value', function(j,v){ return v + '&enablejsapi=1&version=3&playerapiid=ytvideo' + i; }).end() // detach/appendTo required to initialize the wmode code .detach() .appendTo($('#yt-temp')) .attr('id', 'ytvideo' + i) .unwrap(); } }); } } // ***** End script removal consideration *****/ // Set the dimensions if (base.options.resizeContents) { if (base.options.width) { base.$wrapper.add(base.$items).css('width', base.options.width); } if (base.options.height) { base.$wrapper.add(base.$items).css('height', base.options.height); } if (base.hasEmb){ base.$el.find('object, embed').css({ width : '100%', height: '100%' }); } // this only expands youtube videos } // Remove navigation & player if there is only one page if (base.pages === 1) { base.options.autoPlay = false; base.options.buildNavigation = false; base.options.buildArrows = false; } // If autoPlay functionality is included, then initialize the settings if (base.options.autoPlay) { base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true base.buildAutoPlay(); } // Build the navigation base.buildNavigation(); // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first // This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID base.$el.prepend( base.$items.filter(':last').clone().addClass('cloned').removeAttr('id') ); base.$el.append( base.$items.filter(':first').clone().addClass('cloned').removeAttr('id') ); // We just added two items, time to re-cache the list, then get the dimensions of each panel base.$items = base.$el.find('> li'); base.setDimensions(); if (!base.options.resizeContents) { $(window).load(function(){ base.setDimensions(); }); } // set dimensions after all images load // Build forwards/backwards buttons if (base.options.buildArrows) { base.buildNextBackButtons(); } // If pauseOnHover then add hover effects if (base.options.pauseOnHover) { base.$wrapper.hover(function() { if (base.playing) { base.$el.trigger('slideshow_paused', base); if ($.isFunction(base.options.onShowPause)) { base.options.onShowPause(base); } base.clearTimer(true); } }, function() { if (base.playing) { base.$el.trigger('slideshow_unpaused', base); if ($.isFunction(base.options.onShowUnpause)) { base.options.onShowUnpause(base); } base.startStop(base.playing, true); } }); } // If a hash can not be used to trigger the plugin, then go to start panel if ((base.options.hashTags === true && !base.gotoHash()) || base.options.hashTags === false) { base.setCurrentPage(base.options.startPanel, false); } // Fix tabbing through the page base.$items.find('a').focus(function(){ base.$items.find('.focusedLink').removeClass('focusedLink'); $(this).addClass('focusedLink'); base.$items.each(function(i){ if ($(this).find('a.focusedLink').length) { base.gotoPage(i); return false; } }); }); // Hide/Show navigation & play/stop controls base.slideControls(false); base.$wrapper.hover(function(e){ base.hovered = (e.type=="mouseenter") ? true : false; base.slideControls( base.hovered, false ); }); // Add keyboard navigation $(document).keyup(function(e){ if (base.$wrapper.is('.activeSlider')) { switch (e.which) { case 39: // right arrow base.goForward(); break; case 37: //left arrow base.goBack(); break; } } }); }; // Creates the numbered navigation links base.buildNavigation = function() { base.$nav = $('<ul class="thumbNav" />').appendTo(base.$controls); if (base.options.playRtl) { base.$wrapper.addClass('rtl'); } if (base.options.buildNavigation && (base.pages > 1)) { base.$items.each(function(i,el) { var index = i + 1, $a = $("<a href='#'></a>").addClass('panel' + index).wrap("<li />"); base.$nav.append($a.parent()); // use $a.parent() so IE will add <li> instead of only the <a> to the <ul> // If a formatter function is present, use it if ($.isFunction(base.options.navigationFormatter)) { var tmp = base.options.navigationFormatter(index, $(this)); $a.html(tmp); // Add formatting to title attribute if text is hidden if (parseInt($a.css('text-indent'),10) < 0) { $a.addClass(base.options.tooltipClass).attr('title', tmp); } } else { $a.text(index); } $a.bind(base.options.clickControls, function(e) { if (!base.flag) { // prevent running functions twice (once for click, second time for focusin) base.flag = true; setTimeout(function(){ base.flag = false; }, 100); base.gotoPage(index); if (base.options.hashTags) { base.setHash('panel' + base.runTimes + '-' + index); } } e.preventDefault(); }); }); } }; // Creates the Forward/Backward buttons base.buildNextBackButtons = function() { base.$forward = $('<span class="arrow forward"><a href="#">' + base.options.forwardText + '</a></span>'); base.$back = $('<span class="arrow back"><a href="#">' + base.options.backText + '</a></span>'); // Bind to the forward and back buttons base.$back.bind(base.options.clickArrows, function(e) { base.goBack(); e.preventDefault(); }); base.$forward.bind(base.options.clickArrows, function(e) { base.goForward(); e.preventDefault(); }); // using tab to get to arrow links will show they have focus (outline is disabled in css) base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){ $(this).toggleClass('hover'); }); // Append elements to page base.$wrapper.prepend(base.$forward).prepend(base.$back); base.$arrowWidth = base.$forward.width(); }; // Creates the Start/Stop button base.buildAutoPlay = function(){ base.$startStop = $("<a href='#' class='start-stop'></a>").html(base.playing ? base.options.stopText : base.options.startText); base.$controls.append(base.$startStop); base.$startStop .bind(base.options.clickSlideshow, function(e) { base.startStop(!base.playing); if (base.playing) { if (base.options.playRtl) { base.goBack(true); } else { base.goForward(true); } } e.preventDefault(); }) // show button has focus while tabbing .bind('focusin focusout',function(){ $(this).toggleClass('hover'); }); // Use the same setting, but trigger the start; base.startStop(base.playing); }; // Set panel dimensions to either resize content or adjust panel to content base.setDimensions = function(){ var w, h, c, cw, dw, leftEdge = 0, bww = base.$window.width(), winw = $(window).width(); base.$items.each(function(i){ c = $(this).children('*'); if (base.options.resizeContents){ // get viewport width & height from options (if set), or css w = parseInt(base.options.width,10) || bww; h = parseInt(base.options.height,10) || base.$window.height(); // resize panel $(this).css({ width: w, height: h }); // resize panel contents, if solitary (wrapped content or solitary image) if (c.length == 1){ c.css({ width: '100%', height: '100%' }); } } else { // get panel width & height and save it w = $(this).width(); // if not defined, it will return the width of the ul parent dw = (w >= winw) ? true : false; // width defined from css? if (c.length == 1 && dw){ cw = (c.width() >= winw) ? bww : c.width(); // get width of solitary child $(this).css('width', cw); // set width of panel c.css('max-width', cw); // set max width for all children w = cw; } w = (dw) ? base.options.width || bww : w; $(this).css('width', w); h = $(this).outerHeight(); // get height after setting width $(this).css('height', h); } base.panelSize[i] = [w,h,leftEdge]; leftEdge += w; }); // Set total width of slider, but don't go beyond the set max overall width (limited by Opera) base.$el.css('width', (leftEdge < base.options.maxOverallWidth) ? leftEdge : base.options.maxOverallWidth); }; base.gotoPage = function(page, autoplay) { if (typeof(page) === "undefined" || page === null) { page = base.options.startPage; base.setCurrentPage(base.options.startPage); } // pause YouTube videos before scrolling or prevent change if playing if (base.checkVideo(base.playing)) { return; } base.$el.trigger('slide_init', base); if ($.isFunction(base.options.onSlideInit)) { base.options.onSlideInit(base); } base.slideControls(true, false); // Just check for bounds if (page > base.pages + 1) { page = base.pages; } if (page < 0 ) { page = 1; } // When autoplay isn't passed, we stop the timer if (autoplay !== true) { autoplay = false; } // Stop the slider when we reach the last page, if the option stopAtEnd is set to true if (!autoplay || (base.options.stopAtEnd && page == base.pages)) { base.startStop(false); } base.$el.trigger('slide_begin', base); if ($.isFunction(base.options.onSlideBegin)) { base.options.onSlideBegin(base); } // resize slider if content size varies if (!base.options.resizeContents) { // animating the wrapper resize before the window prevents flickering in Firefox base.$wrapper.filter(':not(:animated)').animate( { width: base.panelSize[page][0], height: base.panelSize[page][1] }, { queue: false, duration: base.options.animationTime, easing: base.options.easing } ); } // Animate Slider base.$window.filter(':not(:animated)').animate( { scrollLeft : base.panelSize[page][2] }, { queue: false, duration: base.options.animationTime, easing: base.options.easing, complete: function(){ base.endAnimation(page); } } ); }; base.endAnimation = function(page){ if (page === 0) { base.$window.scrollLeft(base.panelSize[base.pages][2]); page = base.pages; } else if (page > base.pages) { // reset back to start position base.$window.scrollLeft(base.panelSize[1][2]); page = 1; } base.setCurrentPage(page, false); if (!base.hovered) { base.slideControls(false); } // continue YouTube video if in current panel if (base.hasEmb){ var emb = base.$items.eq(base.currentPage).find('object[id*=ytvideo], embed[id*=ytvideo]'); // player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). if (emb.length && $.isFunction(emb[0].getPlayerState) && emb[0].getPlayerState() > 0 && emb[0].getPlayerState() != 5) { emb[0].playVideo(); } } base.$el.trigger('slide_complete', base); if ($.isFunction(base.options.onSlideComplete)) { // Added setTimeout (zero time) to ensure animation is complete... for some reason this code: // alert(base.$window.is(':animated')); // alerts true - http://dev.jquery.com/ticket/7156 setTimeout(function(){ base.options.onSlideComplete(base); }, 0); } }; base.setCurrentPage = function(page, move) { // Set visual if (base.options.buildNavigation){ base.$nav.find('.cur').removeClass('cur'); base.$nav.find('a').eq(page - 1).addClass('cur'); } // Only change left if move does not equal false if (!move) { base.$wrapper.css({ width: base.panelSize[page][0], height: base.panelSize[page][1] }); base.$wrapper.scrollLeft(0); // reset in case tabbing changed this scrollLeft base.$window.scrollLeft( base.panelSize[page][2] ); } // Update local variable base.currentPage = page; // Set current slider as active so keyboard navigation works properly if (!base.$wrapper.is('.activeSlider')){ $('.activeSlider').removeClass('activeSlider'); base.$wrapper.addClass('activeSlider'); } }; base.goForward = function(autoplay) { if (autoplay !== true) { autoplay = false; base.startStop(false); } base.gotoPage(base.currentPage + 1, autoplay); }; base.goBack = function(autoplay) { if (autoplay !== true) { autoplay = false; base.startStop(false); } base.gotoPage(base.currentPage - 1, autoplay); }; // This method tries to find a hash that matches panel-X // If found, it tries to find a matching item // If that is found as well, then that item starts visible base.gotoHash = function(){ var hash = window.location.hash.match(/^#?panel(\d+)-(\d+)$/); if (hash) { var panel = parseInt(hash[1],10); if (panel == base.runTimes) { var slide = parseInt(hash[2],10), $item = base.$items.filter(':eq(' + slide + ')'); if ($item.length !== 0) { base.setCurrentPage(slide, false); return true; } } } return false; // An item wasn't found; }; // Taken from AJAXY jquery.history Plugin base.setHash = function (hash){ // Write hash if ( typeof window.location.hash !== 'undefined' ) { if ( window.location.hash !== hash ) { window.location.hash = hash; } } else if ( location.hash !== hash ) { location.hash = hash; } // Done return hash; }; // <-- End AJAXY code // Slide controls (nav and play/stop button up or down) base.slideControls = function(toggle, playing){ var dir = (toggle) ? 'slideDown' : 'slideUp', t1 = (toggle) ? 0 : base.options.animationTime, t2 = (toggle) ? base.options.animationTime: 0, sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden if (base.options.toggleControls) { base.$controls.stop(true,true).delay(t1)[dir](base.options.animationTime/2).delay(t2); } if (base.options.toggleArrows) { if (!base.hovered && base.playing) { sign = 1; } base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2); base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: t2 }, base.options.animationTime/2); } }; base.clearTimer = function(paused){ // Clear the timer only if it is set if (base.timer) { window.clearInterval(base.timer); if (!paused) { base.$el.trigger('slideshow_stop', base); if ($.isFunction(base.options.onShowStop)) { base.options.onShowStop(base); } } } }; // Handles stopping and playing the slideshow // Pass startStop(false) to stop and startStop(true) to play base.startStop = function(playing, paused) { if (playing !== true) { playing = false; } // Default if not supplied is false if (playing && !paused) { base.$el.trigger('slideshow_start', base); if ($.isFunction(base.options.onShowStart)) { base.options.onShowStart(base); } } // Update variable base.playing = playing; // Toggle playing and text if (base.options.autoPlay) { base.$startStop.toggleClass('playing', playing).html( playing ? base.options.stopText : base.options.startText ); // add button text to title attribute if it is hidden by text-indent if (parseInt(base.$startStop.css('text-indent'),10) < 0) { base.$startStop.addClass(base.options.tooltipClass).attr('title', playing ? 'Stop' : 'Start'); } } if (playing){ base.clearTimer(true); // Just in case this was triggered twice in a row base.timer = window.setInterval(function() { // prevent autoplay if video is playing if (!base.checkVideo(playing)) { if (base.options.playRtl) { base.goBack(true); } else { base.goForward(true); } } }, base.options.delay); } else { base.clearTimer(); } }; base.checkVideo = function(playing){ // pause YouTube videos before scrolling? var emb, ps, stopAdvance = false; if (base.hasEmb){ base.$items.find('object[id*=ytvideo], embed[id*=ytvideo]').each(function(){ // include embed for IE; if not using SWFObject, old detach/append code needs "object embed" here emb = $(this); if (emb.length && $.isFunction(emb[0].getPlayerState)) { // player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5). ps = emb[0].getPlayerState(); // if autoplay, video playing, video is in current panel and resume option are true, then don't advance if (playing && (ps == 1 || ps > 2) && base.$items.index(emb.closest('li.panel')) == base.currentPage && base.options.resumeOnVideoEnd) { stopAdvance = true; } else { // pause video if not autoplaying (if already initialized) if (ps > 0) { emb[0].pauseVideo(); } } } }); } return stopAdvance; }; // Trigger the initialization base.init(); }; $.anythingSlider.defaults = { // Appearance width : null, // Override the default CSS width height : null, // Override the default CSS height resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport tooltipClass : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent) theme : 'default', // Theme name themeDirectory : 'css/theme-{themeName}.css', // Theme directory & filename {themeName} is replaced by the theme value above // Navigation startPanel : 1, // This sets the initial panel hashTags : true, // Should links change the hashtag in the URL? buildArrows : true, // If true, builds the forwards and backwards buttons toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times buildNavigation : true, // If true, builds a list of anchor links to link to each panel toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times navigationFormatter : null, // Details at the top of the file on this use (advanced use) forwardText : "»", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) backText : "«", // Link text used to move the slider back (hidden by CSS, replace with arrow image) // Slideshow options autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not startStopped : false, // If autoPlay is on, this can force it to start stopped pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover resumeOnVideoEnd : true, // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video is complete stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page playRtl : false, // If true, the slideshow will move right-to-left startText : "Start", // Start button text stopText : "Stop", // Stop button text delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds) animationTime : 600, // How long the slideshow transition takes (in milliseconds) easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin // Callbacks onShowStart : null, // Callback on slideshow start onShowStop : null, // Callback after slideshow stops onShowPause : null, // Callback when slideshow pauses onShowUnpause : null, // Callback when slideshow unpauses - may not trigger properly if user clicks on any controls onSlideInit : null, // Callback when slide initiates, before control animation onSlideBegin : null, // Callback before slide animates onSlideComplete : null, // Callback when slide completes // Interactivity clickArrows : "click", // Event used to activate arrow functionality (e.g. "click" or "mouseenter") clickControls : "click focusin", // Events used to activate navigation control functionality clickSlideshow : "click", // Event used to activate slideshow play/stop button // Misc options addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera }; $.fn.anythingSlider = function(options) { // initialize the slider if ((typeof(options)).match('object|undefined')){ return this.each(function(i){ if ($(this).is('.anythingBase')) { return; } // prevent multiple initializations (new $.anythingSlider(this, options)); }); // If options is a number, process as an external link to page #: $(element).anythingSlider(#) } else if (/\d/.test(options) && !isNaN(options)) { return this.each(function(i) { var anySlide = $(this).data('AnythingSlider'); if (anySlide) { var page = (typeof(options) == "number") ? options : parseInt($.trim(options),10); // accepts " 2 " // ignore out of bound pages if ( page < 1 || page > anySlide.pages ) { return; } anySlide.gotoPage(page); } }); } }; })(jQuery); |
Commits for namibia/public/js/vendor/jquery.anythingslider.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |