Automatic scroll to div using #div in url not working with url variable
I am trying to auto-scroll to div using:
/index.php#tabl开发者_高级运维etabs2?contact_added=1
when I use:
/index.php#tabletabs2
it works. How can I have both a variable and the auto-scroll working in my URL???
The query part of the URL needs to be before the #
. Browsers only send the part before the #
to the server. The part after is for auto-scrolling to elements via their id
or name
attribute, e.g.
/index.php?contact_added=1#tabletabs2
See also the "Syntax" section of Wikipedia's "Universal Resource Locator" article. Especially the description of fragment identifiers.
You have to have them in the correct order; ? goes before #:
/index.php?contact_added=1#tabletabs2
精彩评论