[removed] scrollBy function executed on a div

前端 未结 2 1752
难免孤独
难免孤独 2021-02-13 03:55

I have a div with overflow: scroll; And I would like to put a button. When you press it, the content of the div scrolls.

Something like:

2条回答
  •  忘了有多久
    2021-02-13 04:18

    You can try this:

    function scrollDiv(){
        document.getElementById("d").scrollTop += 100;
        document.getElementById("d").scrollLeft += 100;
    }
    

提交回复
热议问题