Advertisement
twinfacer

main_page frontend code

Jun 28th, 2013
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery () ->
  2.   $("#switch a").click (e) ->
  3.     e.preventDefault()
  4.     $(this).tab("show")
  5.  
  6.   $("#switch_license").click (e) ->
  7.     e.preventDefault()
  8.     $(this).tab("show")
  9.  
  10.   $(".slider").cycle({pager: ".slider-nav"});
  11.   closeAlert()
  12.   previewImage()
  13.  
  14.   $(".tab-pane").on("click", ".free", (event) ->
  15.     event.preventDefault()
  16.     $("#ask_email_modal").find("form").prop("action", $(event.target).data("down-url"))
  17.     $("#ask_email_modal").modal("show")
  18.   )
  19.  
  20.  
  21.  
  22. closeAlert = () ->
  23.   $(".close").click () ->
  24.     $(".subscribe *").fadeOut(300, ()->
  25.       $(".subscribe").animate({"height":25},300,() ->
  26.         $(".subscribe").addClass("subscribe-no-txt")
  27.       )
  28.     )
  29.  
  30.  
  31.  
  32. previewImage = () ->
  33.   $(".tab-pane").on("mouseenter", "img", (event) ->
  34.     $(event.target).on("mousemove", (move_event) ->
  35.       preview = $(move_event.target).parents(".image_container").find(".preview")
  36.       preview.removeClass("hide").fadeIn(200).addClass("show")
  37.       winH = parseInt($(window).height())
  38.       triangleY = (move_event.screenY / winH) * 316
  39.       triangleY = 0 if triangleY < 0
  40.       $(".triangle").css("top", "#{triangleY}px")
  41.       triangleT = parseInt($(preview).find(".triangle").css("top"))
  42.       winW = parseInt($(window).width()) / 2
  43.       winH = parseInt($(window).height()) / 2
  44.  
  45.       if move_event.screenX > winW + 167/2
  46.         preview.css("left", "#{(move_event.pageX) - preview.width() - 70}px")
  47.         $(".triangle").removeClass("left").addClass("right")
  48.       else
  49.         preview.css("left", "#{(move_event.pageX) + 40}px")
  50.         $(".triangle").removeClass("right").addClass("left")
  51.  
  52.       preview.css("top", "#{(move_event.pageY) - triangleT - 20}px")
  53.     )
  54.   )
  55.  
  56.   $(".tab-pane").on("mouseleave", "img", (event) ->
  57.     $(event.target).off("mousemove")
  58.     $(".preview").removeClass("show").addClass("hide").hide()
  59.     $(".preview").hide()
  60.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement