如何在外部Javascript完全加载后触发事件
试图触发单击事件并滚动到顶部,但这是一个外部javascript。如何在外部Javascript完全加载后触发事件,javascript,jquery,scrolltop,Javascript,Jquery,Scrolltop,试图触发单击事件并滚动到顶部,但这是一个外部javascript。 请参见下面的嵌入式脚本 (function() { (window.$fs || (window.$fs = [])).push([ "embed", {"root":"fs-embed-vvw2IIvtaz","host":"bikeridersnyc.fullslate.com"} ]); if (!window.$fs._isFullSlate) { var fsscr = document.create
请参见下面的嵌入式脚本
(function() {
(window.$fs || (window.$fs = [])).push([ "embed", {"root":"fs-embed-vvw2IIvtaz","host":"bikeridersnyc.fullslate.com"} ]);
if (!window.$fs._isFullSlate) {
var fsscr = document.createElement("script");
fsscr.type = "text/javascript";fsscr.async = true;
fsscr.src = ["http", (document.location.protocol == "https:" ? "s" : ""), "://bikeridersnyc.fullslate.com/api.js"].join("");
var other = document.getElementsByTagName("script")[0];
other.parentNode.insertBefore(fsscr, other);
}
})();
它是从中嵌入的。
继续生活
现在,我试图在您单击此特定嵌入元素页面上的链接后,将窗口滚动到顶部。像这样的
jQuery(document).ready(function($) {
$('.fs-booking-choices a').click(function() {
$('html, body').scrollTop(0);
return false;
});
});
它应该能工作,但由于某些原因它不能。。。有什么想法吗?
谢谢 为什么不照常进口呢?你能做一把小提琴吗?我在你的页面上找不到它,也许我需要测试一些东西;)我走了另一条路,但谢谢你的帮助!