UNPKG

sudoslider

Version:

An extremely versitile content-slider

102 lines (98 loc) 3.92 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sudo Slider | Fade in the slider on load</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <link rel="STYLESHEET" type="text/css" href="../css/style.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script> <script type="text/javascript" src="../js/jquery.sudoSlider.min.js"></script> <script type="text/javascript" > $(document).ready(function(){ var loadFadeSpeed = 400; var sudoSlider = $("#slider").sudoSlider({ numeric:true, preloadAjax: false, // Using AJAX is of course optional. // But i use it here to show that it works. ajax: [ '../images/01.jpg', '../images/02.jpg', '../images/03.jpg', '../images/04.jpg', '../images/05.jpg' ], loadStart: function () { // In loadStart and loadFinish "this" refers to the SudoSlider object. (Here same as "sudoSlider"). var slides = this.getSlide(this.getValue("currentSlide")); slides.animate( {opacity: 0.5}, { queue: false, duration: loadFadeSpeed } ); }, loadFinish: function () { var slides = this.getSlide(this.getValue("currentSlide")); slides.animate( {opacity: 1}, { queue: false, duration: loadFadeSpeed } ); }, initcallback: function () { var container = $(".slideContainer"); // A little hack to get the actual height of the slider. var height = container.height("auto").height(); container.height(0); // Fadein and SlideIn. container.animate({opacity: 1, height: height}, 800, function () { container.height("auto"); }); } }); }); </script> <style> .slideContainer {opacity: 0.001;height: 0px;} </style> </head> <body> <div id="container"> <h1>Sudo Slider jQuery Plugin - Fade in the slider on load</h1> <div class="slideContainer" style="position:relative;"> <div id="slider"></div> </div> <h3>Usage: see source code</h3> <h3>Note: This demo also showcases loadStart and loadFinish callbacks. These are used to partially fadeOut a slide when we try to go to a slide that has yet to be <loaded class=""></loaded></h3> </div> <div style="width:728px;height:90px;margin:0 auto;"> <script type="text/javascript"> <!-- google_ad_client = "pub-8170632875475442"; /* Sudo Slider, lang horisontal */ google_ad_slot = "0149025622"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <script type="text/javascript"> /* Google Analytics, please remove var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20484420-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); /* */ </script> </body> </html>