Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #43487 from ziggyism/patch-1

Refactor related-video mouse event logic
  • Loading branch information...
commit 49a206c06d99b14be9470f08c4c7cafe47588896 2 parents 70c71be + 16dc2fe
@spicyj spicyj authored
Showing with 9 additions and 20 deletions.
  1. +9 −20 khan-exercise.js
View
29 khan-exercise.js
@@ -676,26 +676,15 @@ var Khan = (function() {
var options = {duration: 150, queue: false};
$(".related-video-box")
.delegate(".thumbnail", "mouseenter mouseleave", function(e) {
- var el = $(e.currentTarget);
- if (e.type == "mouseenter") {
- el.find(".thumbnail_label").animate(
- {marginTop: marginTop},
- options)
- .end()
- .find(".thumbnail_teaser").animate(
- {height: captionHeight},
- options)
- .end();
- } else {
- el.find(".thumbnail_label").animate(
- {marginTop: marginTop + captionHeight},
- options)
- .end()
- .find(".thumbnail_teaser").animate(
- {height: 0},
- options)
- .end();
- }
+ var isMouseEnter = e.type === "mouseenter";
+
+ $(e.currentTarget).find(".thumbnail_label").animate(
+ {marginTop: marginTop + (isMouseEnter ? 0 : captionHeight)},
+ options)
+ .end()
+ .find(".thumbnail_teaser").animate(
+ {height: (isMouseEnter ? captionHeight : 0)},
+ options);
});
},
Please sign in to comment.
Something went wrong with that request. Please try again.