UNPKG

sudoslider

Version:

An extremely versitile content-slider

100 lines (96 loc) 3.47 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 | Responsive demo with maxwidth</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 sudoSlider = $("#slider").sudoSlider({ responsive: true, prevNext: false, numeric:true, continuous:true }); $(window).on("resize focus", function () { var width = $("#slider").width(); var orgSlideCount = sudoSlider.getOption("slideCount"); var slideCount; if (width >= 1200) { slideCount = 3; } else if (width > 900) { slideCount = 2; } else { slideCount = 1; } if (slideCount != orgSlideCount) { sudoSlider.setOption("slideCount", slideCount); } }).resize(); }); </script> <!-- IE6 fix to make max-width work. --> <!--[if lte IE 6]> <script type="text/javascript"> // If you don't want any max-width stuff. Comment out the two lines containing "maxWidth". var maxWidth = 1200; $(document).ready(function(){ $(window).on("resize focus", function () { // $("#container, #slider").width(10); var width = $(window).width(); width = Math.min(width, maxWidth) $("#container, #slider").width(width); }).resize(); }); </script> <![endif]--> <style> #container, #slider {width: auto; max-width: 1200px;} #slider, #slider img {width: 100%;} </style> </head> <body> <div id="container"> <h1>Sudo Slider jQuery Plugin - Responsive demo with maxwidth</h1> <h2>Try to resize the window, and see how the slider adjusts to its container. </h2> <div style="position:relative;"> <div id="slider"> <img src="../images/01.jpg" alt="image description"/> <img src="../images/02.jpg" alt="image description"/> <img src="../images/03.jpg" alt="image description"/> <img src="../images/04.jpg" alt="image description"/> <img src="../images/05.jpg" alt="image description"/> </div> </div> <h3>Usage: See the source code (remember the CSS in the style tag)</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>