In awe I watched the waxing moon ride across the zenith of the heavens like an ambered chariot towards the ebon void of infinite space wherein the tethered belts of Jupiter and Mars hang forever festooned in their orbital majesty. And as I looked at all this I thought... I must put a roof on this lavatory.
-- Les Dawson
Life is conversational. Web design should be the same way. On the web, you’re talking to someone you’ve probably never met – so it’s important to be clear and precise. Thus, well structured navigation and content organization goes hand in hand with having a good conversation.
$('#slider1, #slider2').anythingSlider({ // 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? infiniteSlides : true, // if false, the slider will not wrap enableKeyboard : true, // if false, keyboard arrow keys will not work for the current panel. 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 enableNavigation : true, // if false, navigation links will still be visible, but not clickable. toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times appendControlsTo : null, // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null 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 enablePlay : true, // if false, the play/stop button will still be visible, but not clickable. autoPlay : true, // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not autoPlayLocked : false, // If true, user changing slides will not stop the slideshow 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, the autoplay will pause until the video completes stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false. 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) resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (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 onBeforeInitialize : null, // Callback before the plugin initializes onInitialized : null, // Callback when the plugin finished initializing 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 there is an embedded object & swfobject.js is active, the script will automatically add this wmode parameter maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera });
<head></head>
of your page<!-- Required --> <link type="text/css" href="css/anythingslider.css" rel="stylesheet" media="screen" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.anythingslider.js"></script> <script type="text/javascript"> $(function () { $('#slider1').anythingSlider(); // add any non-default options here }); </script> <!-- Optional --> <script type="text/javascript" src="js/jquery.easing.1.2.js"></script> <script type="text/javascript" src="js/swfobject.js"></script>
<ul id="slider1"> <li><div class="text">Put anything you want here</div></li> <li><img src="image1.jpg" /></li> <li><object>...</object></li> <li> <div class="list"> <h4>Title</h4> <ul> <li>List item #1</li> <li>List item #2</li> </ul> </div> </li> </ul>
$('#slider1') .append('<li><img src="some-image.jpg" alt="" /></li>') // add a new panel to the slider .anythingSlider(); // update the slider
var current = $('#slider1').data('AnythingSlider').currentPage; // returns page #
<a href="#" id="slide-jump">Slide 4</a>$("#slide-jump").click(function(){ $('#slider2').anythingSlider(4); });
$('#slider1').data('AnythingSlider').startStop(true); // start the slideshow $('#slider2').data('AnythingSlider').startStop(false); // stops the slideshow $('#slider1').data('AnythingSlider').goForward(); // go forward one slide $('#slider1').data('AnythingSlider').goBack(); // go back one slide
* Please note that at when the
before_initialize
(onBeforeInitialize
) - triggered right after creating the anythingSlider object. *See Note.initialized
(onInitialized
) - triggered after creating the anythingSlider object.swf_completed
(onSWFComplete
) - triggered when SWFObject completes setting up embedded objects.slideshow_start
(onShowStart
) - slideshow started.slideshow_stop
(onShowStop
) - slideshow stopped.slideshow_paused
(onShowPause
) - slideshow paused.slideshow_unpaused
(onShowUnpause
) - slideshow unpaused - may not trigger properly or match a pause event if user clicks play/stop button.slide_init
(onSlideInit
) - triggered when panel slide is initialized (before controls animate).slide_begin
(onSlideBegin
) - triggered before panel slide animation.slide_complete
(onSlideComplete
) - triggered after panel slide animation.onBeforeInitialize
event triggers/callback is called, almost nothing has been set:That's it! If you want to use some anythingSlider functionalities, you probably want to wait for the initialization to be completed (and register to the event
- The
anythingSlider
object has been attached to theul
.- The class
anythingBase
was added to theul
.- The
ul
was wrapped in twodiv
s (div.anythingSlider div.anythingWindow
).initialized
or use theonInitialized
option).
$('#slider1').bind('slide_complete', function(e, slider){ $('#status').text( 'Now on page #' + slider.currentPage ); // Do something else });
or use one of the callback functions:$('.anythingSlider').bind('slideshow_start slideshow_stop', function(e, slider){ var msg = (e.type == "slideshow_start") ? 'Someone started the #^&%$! slideshow!' : 'Whew, thanks for stopping the slideshow'; $('#status').text( msg ); });
Callback Arguments ( examples are if you use "slider" in the callback function, e.g. function(slider){...}, or in the trigger function, e.g. function(e, slider){...} )$('#slider').anythingSlider({ onSlideComplete : function(slider){ alert('Welcome to Slide #' + slider.currentPage); } })
Argument Description slider.$currentPage jQuery object of the Target page - not the same page as "slider.currentPage". slider.$lastPage jQuery object of the starting page - same page as "slider.currentPage" until "slide_complete" is called. slider.currentPage Currently displayed page/slide number. Updated when the animation completes. slider.pages Number of pages contained in the slider. slider.playing Is true if the slideshow is currently playing (is false when slideshow is paused, but true while youtube video is playing). slider.hovered Is true if the slider is currently being hovered. slider.options.{name} Access any of the options (e.g. slider.options.theme). Trying to set the options this way may break the slider.
navigationFormatter
option, you must have a function that accepts two parameters, and returns a string of HTML text.index
= integer index (1 based);panel
= jQuery wrapped LI item this tab references.$('#slider').anythingSlider({ navigationFormatter : function(index, panel){ return " Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index } })
overflow:hidden
to the anythingslider wrapper to prevent Opera and Safari from adding a horizontal scrollbar.infiniteSlides
option. Fix for issue #58.
stopAtEnd
option is false.stopAtEnd
option is true, the back and forward arrow keys (respectively) will have a "disabled" class applied - modified in the css.