Working with CSS, top propery in JQuery

前端 未结 3 1228
余生分开走
余生分开走 2021-01-29 10:52

I want to change top position of class bbb after 100 ms, but it took out that .css(top) does not work.

Please help.



&l         


        
3条回答
  •  太阳男子
    2021-01-29 11:42

    You should use setTimeout() instead of setInterval() this way alertFun() will only run once.

    let alertFunc = function() {
    
      $('.bbb').css('top', 100 + 'px');
    
    }
    
    setTimeout(alertFunc, 100);
    
    
    
    Bobobo

提交回复
热议问题