jquery: can i animate the position:absolute to position:relative?

前端 未结 5 1376
时光说笑
时光说笑 2021-02-05 21:39

i have a bunch of images that are positioned absolutely, i want to be able to click a button and have them all animate to where they would normally be on the page if they had th

5条回答
  •  一向
    一向 (楼主)
    2021-02-05 22:13

    You can try the css method to make it relative and then animate.

    $(".change_layout").click(function(){
    
        $(".book_img").css({'position': 'relative'}).animate({top:'0px', left:'0px'}, 1000)
    
    })

提交回复
热议问题