简体   繁体   English

带有超时延迟的衰减器(setTimeout内部的setInterval)

[英]Fading ticker with timeout delay (setInterval inside setTimeout)

I want to make a top 10 list where it updates to another set of top 10 list, but tickering the whole list to another is way too boring and simple. 我想制作一个前十名的列表,将其更新为另一组前十名的列表,但是将整个列表添加到另一个列表太无聊又简单。

What I want is to fade out then change each position one after another from top 1 to top 10. 我想要淡出然后将每个位置从顶部1到顶部10依次更改。

I lack knowledge on javascript/jquery. 我缺乏关于javascript / jquery的知识。 but if my logic is right it only needs a 1 sec. 但如果我的逻辑正确,则只需要1秒钟。 timeout delay on each position and each position has the same interval delay changing one to another. 每个位置上的超时延迟和每个位置具有相同的间隔延迟,一个到另一个更改。

Try jQuery for animations 尝试使用jQuery制作动画

I'd suggest using jQuery for animations to fade elements in and out as well as animations, which it sounds like you're asking about. 我建议使用jQuery动画来淡入和淡出元素以及动画,这听起来像是您要问的那样。


jQuery — Fade controls. jQuery —淡入淡出控件。

$(document).ready(function () {
    $('div').fadeToggle('slow'); //Fade in or out based on CSS display:.
    $('div').fadeOut('slow'); //Fade an element (div) out.
    $('div').fadeIn('slow'); //Fade an element (div) in.
});

jQuery — Slide controls. jQuery —滑动控件。

$(document).ready(function () {
    $('div').slideToggle('slow'); //Slide in or out based on CSS display:.
    $('div').slideOut('slow'); //Slide an element (div) out.
    $('div').slideIn('slow'); //Slide an element (div) in.
});

jQuery — Delay an animation. jQuery —延迟动画。

$(document).ready(function () {
    $('div').delay(500).slideToggle('slow'); //Slide in or out based on CSS display: after half a second.
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM