2011-04-20 84 views
2
$(".questionsList").toggle(function() { 
    if (e.target.nodeName == 'h1') { 
     return; 
    } else {  
     $('#slider').animate({ left: '375' }, 500); 
     }, function() { 
      $('#slider').animate({ left: '0'}, 500); 
    } 
}); 
+1

固定缩进,你会看到你的问题 – austinbv 2011-04-20 02:10:09

+1

这就是为什么我们格式化我们的代码更好 – 2011-04-20 02:13:06

回答

4

你需要的是正确的 一个 理智寻找压痕发现问题:)

$(".questionsList").toggle(function() { 
     if(e.target.nodeName == 'h1') { 
      return; 
     } else {  
      $('#slider').animate({ left: '375' }, 500); 
     } 
    }, // <-- you're missing this flower bracket 
    function() { 
     $('#slider').animate({ left: '0'}, 500); 
    }); // <-- you have an extra flower bracket here 
+0

花支架全部!?从来没有听说过这种情况。 AKA大括号/大括号? – 2011-04-20 02:22:50

+0

LMAO花托! Hahahaha – Marko 2011-04-20 02:29:38

+0

Marko的评论非常多,说明我为什么这样称呼它:) – 2011-04-20 03:22:53

0

看起来像你需要一个额外的}} else {..}语句之后,和之前}删除});(你有两个)。

0
$(".questionsList").toggle(function() { 
        if(e.target.nodeName == 'h1') { 
         return; 
        } 
      else {  
        $('#slider').animate({ left: '375' }, 500); 
       }}, function() { 
        $('#slider').animate({ left: '0'}, 500); 
       } 

       );