Jquery 多事件不同显示modi
我想要在不同的事件上,不同的显示modi:Jquery 多事件不同显示modi,jquery,scrollmagic,Jquery,Scrollmagic,我想要在不同的事件上,不同的显示modi: .on("enter leave", function (e) { $("#artwork figcaption").style.display(e.type == "none" ? "block" : "none"); }); 我建议您使用.css(),而不是以这种方式放置样式: .on("mouseenter", function (e) { $("#artwork figcaption").css("display", e.ty
.on("enter leave", function (e) {
$("#artwork figcaption").style.display(e.type == "none" ? "block" : "none");
});
我建议您使用
.css()
,而不是以这种方式放置样式:
.on("mouseenter", function (e) {
$("#artwork figcaption").css("display", e.type == "mouseenter" ? "block" : "none");
});
.on("mouseenter", function (e) {
$("#artwork figcaption").css("display", function(){
return e.type == "mouseenter" ? "block" : "none";
});
});
或者使用.css()
中的回调:
.on("mouseenter", function (e) {
$("#artwork figcaption").css("display", e.type == "mouseenter" ? "block" : "none");
});
.on("mouseenter", function (e) {
$("#artwork figcaption").css("display", function(){
return e.type == "mouseenter" ? "block" : "none";
});
});
使用.css是正确的,您对事件条件的使用是正确的,我还没有看到它。我现在算出了一个结果:。on(“enterleave”,函数(e){$(“#ArtworkFigcaption”).css(e.type==“enter”{display:“block”}:{display:“none”};});