2012-07-28 144 views
0

之前我做了一些修改的CSS!一切都很好,但现在“carouFredSel”功能不断重新加载页面(奇怪的行为) 演示页面的网址是http://demos.illucent.info/butts/index.html 我认为这是在脚本的底部的地方,但我没有哪一个确切caroufredsel重新加载页面

<script type="text/javascript"> 
      $(document).ready(function() { 

      $('#carousel1').carouFredSel({ 
      align:"left", 
      width: '100%', 
      prev: '#prev1', 
      next: '#next1', 
      items : { 
      visible : 13, 
      width : "100%" 
      }, 
      scroll : { 
       items : 2, 
       duration : 1500, 
       pauseDuration : 3500 
      } 

      }); 
      $('#carousel2').carouFredSel({ 
      align:"left", 
      width: '100%', 
      prev: '#prev2', 
      next: '#next2', 
      items : { 
      visible : 13, 
      width : "100%" 
      }, 
      scroll : { 
       items : 2, 
       duration : 1500, 
       pauseDuration : 3500 
      } 
      }); 
      $('#carousel3').carouFredSel({ 
      align:"left", 
      width: '100%', 
      prev: '#prev3', 
      next: '#next3', 
      items : { 
      visible : 13, 
      width : "100%" 
      }, 
      scroll : { 
       items : 2, 
       duration : 1500, 
       pauseDuration : 3500 
      } 
      }); 
      //margins 
      $(".carousel img").css({"margin":"0px 0px 0px 5px"}); 
      var items = $('.list_switch li a').each(function() { 
      $(this).click(function() { 
      //remove previous class and add it to clicked tab 
      items.removeClass('current'); 
      $(this).addClass('current'); 
      }); 
      }); 
      //hide all content divs and show current one 
      $('.wrapper').hide().eq(items.index($(this))).show('fast'); 

      // resume the slide on the selected slider 
      $('.carousel').eq(items.index($(this))).trigger("play"); 
      $('.carousel').eq(items.index($(this))).trigger("slideTo"); 

      // select the first tab on page load  
      items[0].click(); 

      }); 
     </script> 

回答

0

我不认为这是因为CSS的改变。

在$(document).ready函数中,您正在调用集合中名为'items'的第一个项目的click事件。

items[0].click(); 

在您的作品集的第一个元素是这个超链接:

<a href="index.html"> 

其重定向到同一页面。当页面重新加载时,$(document).ready显然会再次执行相同的操作。

尝试注释掉

items[0].click(); 

,你应该发现它停止发生。