单击按钮时最大化按钮

问题描述:

我遇到了麻烦,当我点击img或链接标记时,我的框必须被最大化,并且当我再次单击相同的按钮时,我的框必须最小化。 听我遇到了麻烦,任何一个可以纠正我的问题单击按钮时最大化按钮

  1. 当我点击你好按钮我的盒子必须最大化,当我点击回到它需要得到减少,
  2. 听到这个问题既是按钮越来越大,当我开始点击事件?

我无法找到西隧的问题是

http://jsfiddle.net/Navya/eVUkG/1/

$(function() { 
     $("#button").toggle(
      function() { 
       $("#effect").animate({ 
        backgroundColor: "#0000", 
        width: 500, 

       }, 500); 
      }, 
      function() { 
       $("#effect").animate({ 
        backgroundColor: "#000", 

        width: 240 
       }, 500); 
      } 
     ); 
    }); 
+0

请不要缩进你的链接作为代码,因为它可以防止它被点击的父母。阅读http://*.com/editing-help了解如何格式化您的问题。 – BoltClock 2012-03-30 13:24:50

首先,两个按钮具有按钮的ID。 Id必须是唯一的。其次,定位,而不是仅仅.effect目标按钮(demo

$(function() { 
    $("#container").sortable({ 
     handle: 'h1', 
     scroll: false, 
     revert: true, 
     tolerance: 'pointer' 
    }); 

    $(".button").toggle(function() { 
     $(this).parent().animate({ 
      backgroundColor: "#0000", 
      width: 500, 
     }, 500); 
    }, function() { 
     $(this).parent().animate({ 
      backgroundColor: "#000", 
      width: 40 
     }, 500); 
    }); 

});​