gpt4 book ai didi

jquery - 防止 div 滑动()

转载 作者:行者123 更新时间:2023-12-01 05:00:41 25 4
gpt4 key购买 nike

我有以下内容:

http://jsfiddle.net/2sQGS/

它工作得很好,但我不希望当我将鼠标悬停在简介框上时它会向下滑动。我猜这是因为我不再悬停在该 block 上,但我想以某种方式从任何操作中停用简介框。

如果您需要更多信息,请告诉我,并提前感谢您抽出宝贵的时间。

干杯,史蒂夫

最佳答案

我是 jQuery 新手,所以希望其他人很快就能为你的问题提出更好的解决方案,但我会做的(有效的)就是简单地将 .toggle-block 和 .blurb 放在另一个 div.container 中 block 。

所以你将拥有这样的 html 结构:

<div class="block">
<div class="container">
<a class="toggle-block"><img src="http://www.northareadevonfootball.co.uk/Images/football.jpg"></a>
<div class="blurb">
<h2>Title here</h2>
<p>Hello there, this is a test to take the content over one line so I can see what the line height looks like.</p>
</div>
</div>
</div>

然后你只需将其更改为你的 jquery 代码:

$('.container').mouseleave(function() {
$('.blurb').stop().slideUp(500);
});

它有效...但是还有一些需要改进的地方...如果您需要更多帮助,请告诉我,祝您的项目好运!

关于jquery - 防止 div 滑动(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10481883/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com