开发者

Prevent scrolling for :target selector?

Is there way to prevent scro开发者_运维技巧lling for :target selector, because when a link is fired, scrolling is not smooth.


You can only prevent scrolling by using JS. ... But than :target will no longer work. You could just set a target classname with js and use that. Something like:

<a href="#name" onclick="document.getElementById(this.href.substr(1)).className='target';return false">

css:

:target /* no JS browsers */
, .target /* JS */
{
/* rules */
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜