jQuery:在jQuery hide()完成后进行更改
问题是: 我想要的是,在它向下滑动(单击时滑动)后,黄色高度仅从60px更改为20px。如何修复jQuery:在jQuery hide()完成后进行更改,jquery,html,hide,document-ready,Jquery,Html,Hide,Document Ready,问题是: 我想要的是,在它向下滑动(单击时滑动)后,黄色高度仅从60px更改为20px。如何修复 $(document).ready(function () { $('#slide-link').click(function(){ $(this).animate({ top: $(window).height()-40 },5000) $('#sliderWrapper').stop().hide("slide", { direc
$(document).ready(function ()
{
$('#slide-link').click(function(){
$(this).animate({ top: $(window).height()-40 },5000)
$('#sliderWrapper').stop().hide("slide", { direction:"down" }, 5000);
$('#slide-link').height(20)
//I want 20px to become after #sliderWrapper slided down, not on click
//That's why I put $('#slide-link').height(20) as the last line
// But it triggers asap. How to fix?
})
})
据我所知,$('#滑动链接').height(20)
不会等到$('#滑动rapper').stop().hide(“滑动”,{方向:“向下”},5000)代码>
完成了
另外,$(“#滑动链接”)。延迟(5000)。高度(20)
也没有帮助。为什么?如何修复?.delay()
仅影响使用动画队列的函数。但是,.height()
与动画无关,因此不使用该队列
$(document).ready(function ()
{
$('#slide-link').click(function(){
$(this).animate({ top: $(window).height()-40 },5000)
$('#sliderWrapper').stop().hide("slide", { direction:"down" }, 5000);
$('#slide-link').height(20)
//I want 20px to become after #sliderWrapper slided down, not on click
//That's why I put $('#slide-link').height(20) as the last line
// But it triggers asap. How to fix?
})
})
您需要的是.hide()
的回调,该回调在动画完成后触发:
$('#sliderWrapper').stop().hide("slide", {
direction: "down"
}, 5000, function() {
$('#slide-link').height(20)
});
演示:.delay()
仅影响使用动画队列的函数。但是,.height()
与动画无关,因此不使用该队列
您需要的是.hide()
的回调,该回调在动画完成后触发:
$('#sliderWrapper').stop().hide("slide", {
direction: "down"
}, 5000, function() {
$('#slide-link').height(20)
});
演示:如中?如中?