【发布时间】:2018-02-18 06:49:08
【问题描述】:
我正在尝试制作淡入淡出和滑动效果,它实际上工作正常,但第一次悬停时仍有问题,淡入淡出效果不适用,有人知道出了什么问题吗?
https://jsfiddle.net/y5zndn89/64/
$(document).ready(function() {
$(".example").hide();
$('.show').mouseenter(function() {
$(this).siblings('.example').stop(true, false).animate({
height: 'show'
}, 200);
$(this).siblings('.example').animate({
opacity: 1
}, {
queue: false,
duration: 500
});
})
$('.show').mouseleave(function() {
$(this).siblings('.example').stop(true, false).animate({
height: 'hide'
}, 200);
$(this).siblings('.example').animate({
opacity: 0
}, {
queue: false,
duration: 200
});
})
});
.example {
background-color: blue;
height: 200px;
width: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<button type="button" class="show">Show</button>
<div class="example"></div>
</div>
<div>
<button type="button" class="show">Show</button>
<div class="example"></div>
</div>
<div>
<button type="button" class="show">Show</button>
<div class="example"></div>
</div>
感谢您的帮助。
【问题讨论】:
-
我不知道你的问题在哪里,因为你的小提琴对我来说很好用
标签: jquery