使用 Jquery 移动设备添加延迟
Add delay using Jquery Mobile
使用 JQuery 移动设备我想为以下代码添加延迟,以便 css 在延迟之后才会应用:
$(document).on("scrollstop", function () {
if (!isScrolledIntoView()) {
$("#my-div").css("bottom", "0");
};
});
我试过添加 .delay(800) 但它似乎没有用。关于如何添加延迟的任何想法?谢谢
尝试使用超时。
$(document).on("scrollstop", function () {
if (!isScrolledIntoView()) {
setTimeout(function() { $("#my-div").css("bottom", "0"); }, 800);
};
希望对您有所帮助。
使用 JQuery 移动设备我想为以下代码添加延迟,以便 css 在延迟之后才会应用:
$(document).on("scrollstop", function () {
if (!isScrolledIntoView()) {
$("#my-div").css("bottom", "0");
};
});
我试过添加 .delay(800) 但它似乎没有用。关于如何添加延迟的任何想法?谢谢
尝试使用超时。
$(document).on("scrollstop", function () {
if (!isScrolledIntoView()) {
setTimeout(function() { $("#my-div").css("bottom", "0"); }, 800);
};
希望对您有所帮助。