0
<script  type="text/javascript">

$(document).ready(function(){
  setInterval(spinna, 3000);


var index = 0,
   imgs = ['bg2.jpg', 'scrib.jpg'];
function spinna(){

      console.log(imgs[index]);
      $('#header_bg').fadeIn('slow',function(){
      $('#header_bg').css({   
        'background-image' : 'url(' + '<?php echo get_template_directory_uri(); ?>/library/images/'+ imgs[index] +'' + ')'            
      });  
   });          
    index == 0 ? index = 1 : index = 0;       
 }   
});

实时代码 http://gmcfosho.com/

这段代码我哪里出错了?

对此的任何帮助将是最有帮助的

4

2 回答 2

1

使用 Cycle 之类的插件可能更容易:http: //jquery.malsup.com/cycle/ 查看“scrollRight”效果。

于 2012-05-07T20:01:18.067 回答
0

我终于找到了解决方案。有点取自对 OP 的评论。我使用了一个名为 flexslider 的插件并将其用作遮罩。这是有关如何实现的示例代码。

http://www.designobvio.us/flex

于 2012-05-08T18:15:42.843 回答