Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- previewImage = () ->
- $(".tab-pane").on("mouseenter", "img", (event) ->
- $(event.target).on("mousemove", (move_event) ->
- preview = $(move_event.target).parents(".image_container").find(".preview")
- preview.removeClass("hide").fadeIn(200).addClass("show")
- winH = parseInt($(window).height())
- triangleY = (move_event.screenY / winH) * 316
- triangleY = 0 if triangleY < 0
- $(".triangle").css("top", "#{triangleY}px")
- triangleT = parseInt($(preview).find(".triangle").css("top"))
- winW = parseInt($(window).width()) / 2
- winH = parseInt($(window).height()) / 2
- if move_event.screenX > winW + 167/2
- preview.css("left", "#{(move_event.pageX) - preview.width() - 70}px")
- $(".triangle").removeClass("left").addClass("right")
- else
- preview.css("left", "#{(move_event.pageX) + 40}px")
- $(".triangle").removeClass("right").addClass("left")
- preview.css("top", "#{(move_event.pageY) - triangleT - 20}px")
- )
- )
- $(".tab-pane").on("mouseleave", "img", (event) ->
- $(event.target).off("mousemove")
- $(".preview").removeClass("show").addClass("hide").hide()
- $(".preview").hide()
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement