下拉栏在第二次单击(在输入框中)时恢复,因为它位于动画 div 内 - jquery
目前我有这个
<div id="beau">
<div>
<input type="text" id="lun" name="lun" size="24" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'User Name':this.value;" value="User Name"
style="position:absolute; background-color:transparent; border-style:none; margin-top:53px; margin-left:35px;" />
</div>
<img src="_images/Rollovers/drop bar export.png" alt="extras" width="877" height="160" border="0" />
</div>
<script type='text/javascript'>
$("#beau").toggle(function(){
$(this).stop().animate({marginTop: 738}, "fast");
}, function() {
$(this).stop().animate({marginTop: 680}, "fast");
});
</script>
问题,问题是,我将单击“beau”div 下拉“输入框”和图像(都在“beau”div 内)并且一切正常,但是当我单击“输入框”输入文本,下拉栏再次返回。我知道它为什么这样做,并且我尝试了一些方法来让它工作,但我就是无法得到它。感谢你们所有的帮助:)
at the moment i have this
<div id="beau">
<div>
<input type="text" id="lun" name="lun" size="24" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'User Name':this.value;" value="User Name"
style="position:absolute; background-color:transparent; border-style:none; margin-top:53px; margin-left:35px;" />
</div>
<img src="_images/Rollovers/drop bar export.png" alt="extras" width="877" height="160" border="0" />
</div>
<script type='text/javascript'>
$("#beau").toggle(function(){
$(this).stop().animate({marginTop: 738}, "fast");
}, function() {
$(this).stop().animate({marginTop: 680}, "fast");
});
</script>
and what the problem is, is that i will click the "beau" div to drop down the "input box" and the image (both inside the "beau" div) and that all works fine but but when i click in the "input box" to type text the drop bar goes back up again. i know why it does it and I've tried a few things to get it working but i just can't get it. thanks for all your help guys :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种选择是为输入添加一个处理程序,以停止传播到 div:
One option is to add a handler for the input that stops propagation to the div: