Advertisement
ans4175

jquery_cycle

Dec 28th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.70 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  5. <meta http-equiv="Content-Style-Type" content="text/css" />
  6. <title>Slider_next_prev_pause_resume</title>
  7. <link rel="stylesheet" type="text/css" media="screen" href="../jq.css" />
  8. <link rel="stylesheet" type="text/css" media="screen" href="cycle.css" />
  9. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  10. <script type="text/javascript" src="http://malsup.github.com/chili-1.7.pack.js"></script>
  11. <script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
  12. <style type="text/css">
  13.     #main { margin: 20px }
  14.     #nav { margin: 15px }
  15.     #nav li { float: left; list-style: none}
  16.     #nav a { margin: 5px; padding: 3px 5px; border: 1px solid #ccc; background: #fc0; text-decoration: none }
  17.     #nav li.activeSlide a { background: #faa; color: black }
  18.     #nav a:focus { outline: none; }
  19. </style>
  20. <script type="text/javascript">
  21.     var desc = new Array();
  22.     function onAfter(curr, next, opts) {
  23.         var index = opts.currSlide;
  24.         //alert(desc[index]);
  25.     }
  26. $(function() {
  27. $i=0;
  28. $('#slideshow').before('<div id="nav">').cycle({
  29.     fx:     'scrollHorz',
  30.         //speed:  'fast',
  31.         timeout:  1000,
  32.         prev:    '#prev',
  33.         next:    '#next',
  34.         pager:   '#nav',
  35.         after:  onAfter,
  36.         pagerAnchorBuilder: pagerFactory,
  37.         //pagerEvent: 'keyup',
  38.         //pauseOnPagerHover:
  39. });
  40.     $(document.documentElement).keyup(function (e) {
  41.         if (e.keyCode == 39)
  42.         {        
  43.            $('#slideshow').cycle('next');
  44.         }
  45.         else if (e.keyCode == 37)
  46.         {
  47.             $('#slideshow').cycle('prev');
  48.         }
  49.         else if (e.keyCode == 13)
  50.         {
  51.             $i = !$i;
  52.             if ($i == 1)
  53.             {
  54.             $('#slideshow').cycle('pause');
  55.             $('#pause').show();
  56.             }
  57.             else
  58.             {
  59.             $('#slideshow').cycle('resume');
  60.             $('#pause').hide();
  61.             }
  62.         }
  63. });
  64.     function pagerFactory(idx, slide) {
  65.         var s = idx > 7 ? 'style="display:none"' :'';
  66.         return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
  67.     };    
  68. });
  69. </script>
  70. </head>
  71. <body>
  72. <div><a id="logo" href="http://jquery.com" title="Powered By jQuery"></a></div>
  73. <div id="main">
  74.     <div style="width:700px;margin: 0 auto;clear:left;">
  75.         <div id="demos">
  76.             <div id="slideshow" class="pics" style="clear:both;margin-top:10px;float:left">
  77.                 <img src="http://malsup.github.com/images/beach1.jpg" />
  78.                 <img src="http://malsup.github.com/images/beach2.jpg" />
  79.                 <img src="http://malsup.github.com/images/beach3.jpg" />
  80.                 <img src="http://malsup.github.com/images/beach4.jpg" />
  81.                 <img src="http://malsup.github.com/images/beach5.jpg" />
  82.                 <img src="http://malsup.github.com/images/beach6.jpg" />
  83.                 <img src="http://malsup.github.com/images/beach7.jpg" />
  84.                 <img src="http://malsup.github.com/images/beach8.jpg" />
  85.             </div>
  86.             <div id="isiteks" style="margin:15px; float:left">
  87.                 ini sebuah teks sahaja
  88.             </div>
  89.             <div style="clear:both"></div>
  90.         </div>
  91.         <div id="pause" style="display:none">Pause</div>
  92.     </div>
  93.     <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
  94.     <script type="text/javascript">
  95.     _uacct = "UA-850242-2";
  96.     urchinTracker();
  97.     </script>
  98. </div>
  99. </body>
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement