이 코드를 사용하여 오른쪽에서 div를 슬라이드 (button_panel) 버튼을 클릭하면 모든 것이 올바르게 작동하지만 div 패널 내부의 버튼을 클릭하면 패널로 돌아갑니다. 원래 위치. 그것은 click 이벤트가 button_panel에 대해서만 사용되기 때문에 발생하지 않아야합니다. 왜 그런가?div 패널을 다시 누르면 div 패널 내부의 버튼을 클릭합니다.
var sipPos = 0;
$(document).ready(function() {
$("#button_panel").click(function (e) {
e.preventDefault();
$("#panel").animate({ right: sipPos }, 300, 'linear', function() {
if (sipPos == 0) { sipPos = -150; }
else { sipPos = 0; }
});
});
});
<div id="panel" style=" border-style: solid; border-color: #008000; background-color:#D5FFD5; width:150px; height:400px; right:-150px; top:142px; position:absolute" align="center" >
<asp:ImageButton ID="button_panel" runat="server" style=" background-image: url('images/ProgressBar1.jpg'); width:80px; height:30px; left:-83px; margin-top:-12px; position:absolute; top:0px" Font-Bold="True" ImageUrl="~/images/green_left_arrow_104.jpg" />
<asp:Label ID="Label6" runat="server" style="margin-top:5px" Text="Timer" /><br />
<asp:Button ID="Button1" runat="server" style="margin-top:5px" Text="AFK!" /><br />
<asp:Button ID="Button2" runat="server" style="margin-top:5px" Text="REVIEW" /><br />
</div>
가 너무 HTML의 조각을하시기 바랍니다 게시 할 수 있습니까? – JonVD