开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜