简单来说,执行此JavaScript时,我需要添加一些要注入的CSS。但是,由于无法访问该文件,因此无法执行此操作,因此需要在页面级别进行。我无法正确定位它。
我已经测试了几件事,但是还没有任何运气。
jQuery($("#mobileFilterModal").click(function() {
alert("Btn 1 Clicked");
});
customFunction() {
alert("Btn 1 Clicked");
}
mobileFilterModal().done( customFunction() );
function functionOne(x) {return x};
function functionTwo(var1) {
console.log("it worked");
}
functionTwo(functionOne);
function myFunction() {
console.log("sweet");
}
这是我要定位的JavaScript文件的一部分:
mobileFilterModal: function() {
var a = ($("html").offset().top, $(window).height()),
b = $(".klg-active-filter-modal");
$(".klg-micrositeLogoTitle").hide(), $(".klg-micrositeTitle").hide(), $("html, body").css({
height: a + "px",
overflow: "hidden"
}), 0 != $(".klg-actual-mainHeader").length ? ($("body").prepend('<div class="klg-hideBackGround"></div>'), b.find(".klg-newsfilter-modal").css({
height: a - 90 + "px",
"overflow-y": "scroll"
})) : ($("body").prepend('<div class="klg-hideBackGround"></div>'), b.find(".klg-newsfilter-modal").css({
height: a - 105 + "px",
"overflow-y": "scroll"
})), b.find(".klg-newsfilter-modal").addClass("klg-showModal").css(0 != $(".klg-actual-mainHeader").length ? {
top: "-80px"
} : {
top: "-100px"
}), b.find(".klg-newsfilter-modal").bind("touchmove", function(a) {
$(this).scrollTop()
}), $(".klg-newsfilter-modal").trigger("click")
},
hideFilterPopup: function() {
$(".klg-hideBackGround").remove(), $(".klg-newsfilter-modal").removeClass("klg-showModal"), $(".klg-micrositeLogoTitle").show(), $(".klg-micrositeTitle").show(), $(".klg-news-filter-ParentSection").removeClass("klg-active-filter-modal"), $("html, body").on("touchstart touchmove", function(a) {
$(this).css({
height: "auto",
overflow: ""
})
})
},