带自动旋转器的1k图像/内容滑块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了带自动旋转器的1k图像/内容滑块相关的知识,希望对你有一定的参考价值。

Small image- and content slider with menu generation and auto-rotator.
The auto-rotator stops, when menu is clicked. Text of the menu is taken from the title-tag of the image(can easily be changed!). Minified size < 1kb.

Call it with
$('.someClass').joeSlide();
  1. <div class="someClass">
  2. <ul class="sliderContent">
  3. <li>Slide 1 <img src="image1.jpg" title="Title 1" /></li>
  4. <li>Slide 2 ...</li>
  5. </ul>
  6. </div>
  7. CSS(just as i used it):
  8. .someClass { height:320px; background:url('../images/bg_slider.gif') repeat-x; position:relative; }
  9. .someClass ul { list-style:none; }
  10. .sliderContent { position:relative; height:300px; width:960px; margin:8px 0; margin:0; padding-top:10px; overflow:hidden;}
  11. .sliderThumbs { position:absolute; bottom:10px; }
  12. .sliderThumbs li { float:left; width:192px; height:54px; text-align:center; line-height:60px; cursor:pointer; background:url('../images/buttons_slider.png') no-repeat scroll right 10px transparent }
  13. .sliderThumbs li:hover { background-position:right -44px; }
  14. .sliderThumbs li.active{ background-position:right -98px; }
  15.  
  16. jQuery Function:
  17. (function($){
  18. $.fn.extend({
  19. joeSlide: function() {
  20. return this.each(function() {
  21. var t;
  22. var obj = $(this);
  23.  
  24. obj.append('<ul class="sliderThumbs">');
  25. $('li', obj).each(function (index) {
  26. $('.sliderThumbs', obj).append('<li>' + $(this).children('img').attr('alt') + '</li>');
  27. });
  28. $('.sliderThumbs li', obj).last().addClass('active');
  29.  
  30. $('.sliderThumbs li', obj).live('click', function(){
  31. clearTimeout(t);
  32.  
  33. if( $('.sliderContent li:visible', obj).index() > $(this).index() )
  34. $('.sliderContent li', obj).eq($(this).index()).show().siblings().fadeOut(600);
  35. else
  36. $('.sliderContent li', obj).eq($(this).index()).fadeIn(600, function(){ $(this).siblings().hide(); });
  37.  
  38. $('.sliderThumbs li.active', obj).removeClass('active');
  39. $(this).addClass('active', obj);
  40. });
  41.  
  42. var sliderNext = function() {
  43. if(!$(".sliderThumbs li", obj).last().hasClass('active'))
  44. $(".sliderThumbs li.active", obj).next().click();
  45. else
  46. $(".sliderThumbs li", obj).eq(0).click();
  47.  
  48. t = setTimeout(sliderNext, 5000);
  49. }
  50. sliderNext();
  51. });
  52. }
  53. });
  54. })(jQuery);

以上是关于带自动旋转器的1k图像/内容滑块的主要内容,如果未能解决你的问题,请参考以下文章

css 带标签的滑块旋转木马

在旋转滑块上方放置图像

使用jQuery滑块旋转(度)图像

使用滑块更改 Phong 着色器的值

在百里香弹簧靴中,动态旋转木马滑块不起作用

css 简单的滑块/旋转脚本。留下了一个右箭头。也自动旋转。