Jquery.address page jump issue in scrolling scenar

2019-08-23 12:16发布

问题:

How to use the "wrap" method of jquery.address?

I'm trying to avoid page scrolling jump when i call the $.address.change(fn). Jquery.address add # to my url so by default page suddenly scroll to top... ooh this drive me crazy..

$.address.wrap() Returns: Boolean Provides the state of the wrap mode. Disabled by default.

$.address.wrap(value) Returns: jQuery Address Enables or disables the wrap mode which generates a DIV wrapper around the page content and fixes any scroll issues caused by the use of hash fragments.

回答1:

I have never used wrap() before, but avoided scrolling with return false; at the end of the $.address.change(fn).