asimryu

index.html with jquery popup

Jan 16th, 2017
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.10 KB | None | 0 0
  1. // app.js
  2. var slide = $("header > img");
  3. var sno = 0;
  4. var eno = slide.length - 1;
  5.  
  6. $("header").on("click",function(){
  7.     $( slide[sno] ).animate({
  8.   left: "940px"
  9.  },1000,function(){
  10.   $(this).css({left:"-940px"});
  11.  });
  12.  sno++;
  13.  if( sno > eno ) sno = 0;
  14.  $( slide[sno] ).animate({
  15.   left: "0"
  16.  },1000);
  17. });
  18.  
  19. var timer = setInterval(function(){
  20.  $("header").click();//trigger
  21. },2000);
  22.  
  23. $("nav > ul > li").hover(
  24.  function(){
  25.   $(this).children("ul").slideDown();
  26.  },
  27.  function(){
  28.   $(this).children("ul").slideUp("fast");
  29.  }
  30. );
  31.  
  32. $(".topic img").on("click",function(e){
  33.     $("#popup").hide();
  34.     // 화면 한가운데 위치 조정
  35.     // var wh = $(window).height() / 2;
  36.     // var ww = $(window).width() / 2;
  37.     // var x = ww - 250;
  38.     // var y = wh - 250;
  39.     // 마우스 포인터 위치
  40.     var x = e.pageX - 250;
  41.     var y = e.pageY - 250;
  42.     $("#popup").css({left:x+"px",top:y+"px"});
  43.     var src = $(this).attr("src");
  44.     var img = "<img src='" + src + "' width='500' height='500'>";
  45.     $("#popup").html(img);
  46.     $("#popup").show("slow");
  47. });
  48.  
  49. $("#popup").on("click",function(){
  50.     $(this).hide("slow");
  51. });
Advertisement
Add Comment
Please, Sign In to add comment