我想防止它干扰其他切换。
$(".button-info").click(function() {
$("#info").fadeToggle("fast");
$("#info").css("z-index", "-1");
});
答案 0 :(得分:1)
您可以像下面一样使用css
。
$("#info").css("z-index", function(index, val) {
return parseInt(val, 10) - 1;
});
答案 1 :(得分:0)
如果您想大量使用此组合,则可以编写自己的jQuery函数。
//in helper.js
startRecordResponse() {
const helper = this.helpers['Puppeteer'];
helper.page.on("response", (res) => {
//record all response instance into savedResponse object inside page, we'll use it later
helper.page.savedResponse = helper.page.savedResponse || {};
helper.page.savedResponse[res.url()] = res;
});
return helper._waitForAction();
}
checkFileIsTooBig(filter, sizeLimit) {
const helper = this.helpers['Puppeteer'];
//use the data recorded in savedResponse object
Object.keys(helper.page.savedResponse).forEach((url) => {
var res = helper.page.savedResponse[url];
if (((filter instanceof RegExp && filter.test(url)) || (typeof filter == "string" && url.indexOf(filter) != -1)) && res.headers()['content-length'] > sizeLimit) {
throw new Error(`file ${url} is too big,${res.headers()['content-length']} > ${sizeLimit}`)
}
})
return helper._waitForAction();
}
Before((I) => {
I.startRecordResponse();
I.amOnPage("https://www.github.com");
});
Scenario('github_test', (I) => {
//check a js file contain github is less than 100 bytes
I.checkFileIsTooBig(/github.*\.js/,100);
}
);
(function($) {
$.fn.fadeToggleZ = function() {
return this.fadeToggle("fast").css("z-index", (parseInt(this.css("z-index")) - 1));
};
}(jQuery));
$(".button-info").click(function() {
$("#info").fadeToggleZ();
});