首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MediaTemple上的jQuery幻灯片

MediaTemple上的jQuery幻灯片
EN

Stack Overflow用户
提问于 2010-05-08 13:32:42
回答 3查看 197关注 0票数 0

我想做一个幻灯片产品的东西,如http://www.mediatemple.net主页,那里有那些大的圆点在右边。我试着用谷歌搜索,但找不到类似的。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2010-05-08 13:40:15

他们的代码直接在页面中。稍微研究一下css,就会把您引向正确的方向。

代码语言:javascript
复制
$(document).ready(function() {

  var nrgtiles = $('div[class^=homesplash]').length;

/*   alert(nrgtiles); */

  $('body').append('<div id="nrgrotate">&nbsp;</div>');

  var i=1;

  while (i<=nrgtiles) {

    $('#nrgrotate').append('<a href="#"><em>&nbsp;</em></a>');

  i++;
  }

  $('#nrgrotate a:eq(0)').addClass('active');

  $('#nrgrotate a:eq(0)').click(function() {

    homeFadeOut();

    return false;

  });

  $('#nrgrotate a:eq(1)').click(function() {

    homeFadeIn();

    return false;

  });

  $('.homesplash2').hide();

  timer = setTimeout(homeFadeIn, 10000);

});

function homeFadeIn() {

  clearTimeout(timer);

  $('#nrgrotate a:eq(0)').removeClass('active');
  $('#nrgrotate a:eq(1)').addClass('active');

  $('.homesplash2').fadeIn(1000, function() {

    timer = setTimeout(homeFadeOut, 10000);

  });

}

function homeFadeOut() {

  clearTimeout(timer);

  $('#nrgrotate a:eq(1)').removeClass('active');
  $('#nrgrotate a:eq(0)').addClass('active');

  $('.homesplash2').css('margin-top', '-263px').fadeOut(1000, function() {

    timer = setTimeout(homeFadeIn, 10000);

  });

}
票数 0
EN

Stack Overflow用户

发布于 2010-05-08 13:38:52

试试jQuery Cycle插件:http://jquery.malsup.com/cycle/

票数 0
EN

Stack Overflow用户

发布于 2011-01-11 18:24:04

我推荐使用jQuery Nivo Slider:http://nivo.dev7studios.com/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2793050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档