Moving Background image in a loop from left to right

后端 未结 6 1896
难免孤独
难免孤独 2021-02-05 21:18

I would like to have a moving background image on my page from left to right exactly the same way as in following website http://kxip.in , please suggest how to achieve this.

6条回答
  •  名媛妹妹
    2021-02-05 22:05

    Use some js/jQuery:

    function move(){
        var element = $('#selector');
        element .css('background-position-x', (parseInt(element.css('background-position-x') - 10));
        //Check if need to reset background-position-x to origin.
    }
    

提交回复
热议问题