当URL更改滚动到某个哈希时,将类添加到DIV
我的URL hash更改scroll 从
等等。这是一个完整的滚动效果。
想做的是在URL上的滚动变为#-2-2
我
$(document).ready(function () {
if (window.location.href.indexOf("emotion--2") > -1) {
$('#shirt').addClass('draw-shirt');
}
});
$(window).scroll(function () {
function locationHashChanged() {
if(window.location.href.indexOf("emotion--2") > -1) {
$('#shirt').addClass('draw-shirt');
}
}
});
。 IS www.website.com#section-section--2--2- in Load on Load,但不在滚动上。
该代码
function isScrolledIntoView(elem) {...etc...
由于完整的滚动效应,
在这里无法使用。感谢您的帮助。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以使用“ nofollow noreferrer”>本地窗口对象的hashchange 事件。
I think you could use the native
hashchange
event of the window object.