首页 新闻 赞助 找找看

jquery delay显示不出来show(400),这是怎么回事??

0
悬赏园豆:20 [已解决问题] 解决于 2014-12-26 11:49
 1    <script type="text/javascript">
 2         $(function(){
 3           function closewin(){
 4              $('.theme-popover-mask').fadeOut(200);
 5              $('.theme-popover').slideUp(200);
 6           }
 7           
 8           function openwin(){
 9              $('.theme-popover-mask').fadeIn(200);
10              $('.theme-popover').slideDown(200);
11           }
12           var arr=[
13              "app/AppleUc/index.html",
14              "app/AppleWeb/index.html",
15              "app/AppleWeixin/index.html"
16           ];        
17           var arr2=[
18              "app/AndroidUc/index.html",
19              "app/AndroidWeb/index.html",
20              "app/AndroidWeixin/index.html"
21           ];
22           
23           
24           $(".weixin_app span a").click(function(){
25                  if($('.theme-popover-mask').addClass("cshow")){
26                      $('.theme-popover-mask').removeClass("cshow");
27                  }
28                  var val="",num=0;
29                  if($(this).attr("class")=="apple"){
30                        val=$("#theTemplate").text();
31                        num=1;
32                  }else{
33                        val=$("#theTemplate2").text();
34                        num=2;
35                  }
36                  $(".dform").html(val);
37                  if(num==1){
38                      $(".dform").find("li").addClass("appli");
39                  }else{
40                      $(".dform").find("li").addClass("andli");
41                  }
42                  openwin();
43                $(".dform li").each(function(){
44                       $(this).click(function(){
45                              closewin();
46                              $('.theme-popover-mask').addClass("cshow").fadeIn(200);
47                              if($(this).attr("class")=="appli"){
48                                 $(".show_iframe").delay(1000).show(400);
49                                 $(".iframe").attr("src",arr[i]);
50                              }else{
51                                    $(".show_iframe").delay(1000).show(400);
52                                    $(".iframe").attr("src",arr2[i]);
53                              }
54                       });
55                       $('.theme-popover-mask').removeClass("cshow");
56                       
57                });
58             
59           });
60           $(".close_x").click(function(){
61                $('.theme-popover-mask').addClass("cshow").fadeOut(200);
62                $(".show_iframe").hide(400);      
63           });
64           $('.theme-poptit .close').click(function(){
65                closewin();
66           })        
67         });
68         </script>

<div class="theme-popover">
<div class="theme-poptit">
<a href="javascript:;" title="关闭" class="close">×</a>
</div>
<div class="dform"></div>
</div>
<div class="theme-popover-mask"></div>
<div class="show_iframe">
<a href="javascript:;" class="close_x"></a>
<iframe id="iframe" class="iframe" src="#" frameborder="0" scrolling="no">
</iframe>
</div>
<textarea id="theTemplate" style="display:none">
<ul>
<li><a href="javascript:;">苹果UC二维码安装</a></li>
<li><a href="javascript:;">苹果浏览器安装</a></li>
<li><a href="javascript:;">苹果微信安装</a></li>
</ul>
</textarea>
<textarea id="theTemplate2" style="display:none">
<ul>
<li><a href="javascript:;">安卓UC二维码安装</a></li>
<li><a href="javascript:;">安卓浏览器安装</a></li>
<li><a href="javascript:;">安卓微信安装</a></li>
</ul>
</textarea>

小鬼文的主页 小鬼文 | 初学一级 | 园豆:108
提问于:2014-12-24 09:50
< >
分享
最佳答案
0
if($('.theme-popover-mask').addClass("cshow")){
    $('.theme-popover-mask').removeClass("cshow");
}

1. 这里的if条件应该有问题

 

if($(this).attr("class")=="appli"){
    $(".show_iframe").delay(1000).show(400);
    $(".iframe").attr("src",arr[i]);
}else{
    $(".show_iframe").delay(1000).show(400);
    $(".iframe").attr("src",arr2[i]);
}

2.这里的arr[i]和arr2[i]中的变量i好像是未定义的

 

3.没有css文件,我猜测show_iframe这个div是不是一开始就是显示状态,当然就看不到动画效果了

收获园豆:20
ThreeTree | 小虾三级 |园豆:1490 | 2014-12-24 23:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册