powerSwitch
powerSwitch copied to clipboard
万能切换插件,选项卡、跑马灯、手风琴、无限切换都不在话下~
大神,文字广告重复循环滚动的功能,从别的标签页再切换回当前页面时会发生滚动异常。 是这样的,刚进入页面一切正常,默认的滚动是由下到上,然后新开个标签页去,过了一会再切换回当前页面,滚动一瞬间是由上到下了,然后才是由下到上,怎么解决这个问题哈 $(".comment li")..powerSwitch({ autoTime: 8000, hoverStop:false, duration:1000, direction: "vertical", animation: "translate" });
错误信息: `Uncaught RangeError: Maximum call stack size exceeded.` 原因是: 使用location.replace会导致页面重新加载,当有hash值时,`powerSwitch`会自动触发click事件(576行),而`click`事件会触发`onSwitch`事件,所以就死循环了. ``` if (anchorSplit && element.href && anchorSplit == element.href.split("#")[1]) { $(element).trigger("click"); } ```