2014-08-29 92 views
0

http://streamplex.us/web/smartphone-services/这是我工作的网站。我正在尝试获取它,因此.services-wrap的高度是否更改#samsung-repair已打开。为什么不是这个jquery if语句工作

<script> //Services Toggle 
    $(document).ready(function(){ 
     $("#samsung").click(function(){ 
     $("#samsung-repair").toggle("slide", 300); 
     }); 

     $("#iphone").click(function(){ 
     $("#iphone-repair").toggle("slide", 300, function() { 
      $("#computer-repair-img").toggleClass("section-pad", 300, function() { 
       if($("samsung-repair").is(':visible')){ 
        $(".services-wrap").css({"height" : "355px"}); 
       } else if ($("samsung-repair").is(':hidden')) { 
        $(".services-wrap").css({"height" : "700px"}); 
       }; 
      }); 
     }); 
     }); 

     $("#computer").click(function(){ 
     $("#computer-repair").toggle("slide", 300); 
     }); 

    }); 
    </script> 

谢谢大家我知道了,我只是想让它现在就工作。

$("#iphone").click(function(){ 
    $("#iphone-repair").toggle("slide", 300, function() { 
      if($("#samsung-repair").is(':visible')){ 
       $("#computer-repair-img").toggleClass("section-pad", 300); 
      } else if ($("#samsung-repair").is(':hidden')) { 
       $(".services-wrap").toggleClass("section-height", 300); 
      }; 
    }); 
    }); 

回答

1
if($("#samsung-repair").is(':visible')){ //put '#' here 

在这里也

else if ($("#samsung-repair").is(':hidden')) { //put '#' here 
+0

哇我现在感到很蠢,谢谢你的帮助。 – Trammell 2014-08-29 09:24:07

+0

@Trammell ...您的欢迎.. – 2014-08-29 09:24:24

+0

我重新选择了您的对不起,我没有意识到它会取消您的信任。我认为这是选择他的也是对的。 – Trammell 2014-08-29 09:29:04

2

要调用与$("samsung-repair")股利,但它应该是$("#samsung-repair")

+0

谢谢你我知道它的工作方式就是我想要的。 – Trammell 2014-08-29 09:25:33