0

I wanted on different events, different display modi:

.on("enter leave", function (e) {
    $("#artwork figcaption").style.display(e.type == "none" ? "block" : "none");
});
Jai
  • 74,255
  • 12
  • 74
  • 103

1 Answers1

0

Instead of putting styles this way i suggest you to use .css():

.on("mouseenter", function (e) {
    $("#artwork figcaption").css("display", e.type == "mouseenter" ? "block" : "none");
});

or using a callback in .css():

.on("mouseenter", function (e) {
    $("#artwork figcaption").css("display", function(){
        return e.type == "mouseenter" ? "block" : "none";
    });
});
Jai
  • 74,255
  • 12
  • 74
  • 103
  • to use .css was correct, you were right with the event condition, I haven't seen it. I figured out as a result now: .on("enter leave", function (e) { $("#artwork figcaption").css(e.type == "enter" ? {display:"block"} : {display:"none"}); }); – Taki Kiometzis Sep 24 '15 at 14:32