How to set top position using jquery

后端 未结 5 686
一向
一向 2021-02-04 23:22

I am creating custom div scroller and want to set top position of content div. My jquery code is as below:

containerOuterHeight=$(\"#messagePopUpContainer\").out         


        
5条回答
  •  旧时难觅i
    2021-02-04 23:57

    Just for reference, if you are using:

     $(el).offset().top 
    

    To get the position, it can be affected by the position of the parent element. Thus you may want to be consistent and use the following to set it:

    $(el).offset({top: pos});
    

    As opposed to the CSS methods above.

提交回复
热议问题