Delay CSS function in Jquery?

后端 未结 8 1252
自闭症患者
自闭症患者 2021-02-13 11:12

How can I delay a CSS change in jquery? Here is my code:

$(\"document\").ready(function() {
    $(\".pressimage img\").mouseenter(function() {
        $jq(this)         


        
8条回答
  •  死守一世寂寞
    2021-02-13 11:36

    Delay only works on items in the queue so you need to add your css change to the queue for the delay to work. Then dequeue. The following code illustrates this:

    $('.pressimage img')
        .delay(1000)
        .queue(function(){
            $(this).css({'z-index','1'});
            $(this).dequeue();
        });
    

提交回复
热议问题