Wacky_rubia

галерея

Oct 29th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.95 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8">
  5.         <title>Adaptive</title>
  6.     </head>
  7.     <body>
  8.         <h1>Галерея <span>Image 1</span></h1>
  9.         <p><img id="largeImg" src="img1-lg.jpg" alt="Large image"/></p>
  10.         <p class="thumbs" style=float-bottom:  >
  11.         <a href="img1-lg. jpg" title="Image 1"><img src="img1-thumb.jpg" /></a>
  12.         <a href="img2-lg.jpg" title="Image 2"><img src="img2-thumb.jpg" /></a>
  13.         <a href="img3-lg.jpg" title="Image 3"><img src="img3-thumb.jpg" /></a>
  14.         </p>
  15.     </body>
  16. </html>
  17. <script src="j.js"></script>
  18. <script>
  19.     $("a img").click(function() {
  20.         $("#largeImg").attr("src", $(this).parents("a").attr("href"));
  21.         $("h1 span").html($(this).parents("a").attr("title"));
  22.         return false;
  23.     });
  24. </script>
  25. <script>
  26.     $('#largeImg').click(function() {
  27.         var docHeight = $(document).height();
  28.         $("<div id='overlay'></div>")
  29.         .appendTo("body")
  30.         .height(docHeight)
  31.         .css({
  32.             'opacity': 0.7,
  33.             'position': 'absolute',
  34.             'top': 0,
  35.             'left': 0,
  36.             'background-color': 'black',
  37.             'width': '100%',
  38.             'z-index': 1
  39.         });
  40.  
  41.         $("<button id='b'>закрыть</button>")
  42.         .appendTo("body")
  43.         .height(docHeight)
  44.         .css({
  45.             'position': 'absolute',
  46.             'top': 0,
  47.             'left': '1000px',
  48.             'width': '100px',
  49.             'height': '20px',
  50.             'z-index': 2
  51.         });
  52.  
  53.         $('#largeImg').css({
  54.             'z-index': 3,
  55.             'position' : 'absolute',
  56.             'left' : '100px',
  57.             'top' : '100px'
  58.         });
  59.  
  60.         $("#b").click(function() {
  61.             $("#overlay").remove();
  62.             $(this).remove();
  63.             $('#largeImg').css({
  64.                 'position': 'static'
  65.             })
  66.         })
  67.  
  68.     });
  69.  
  70.  
  71. </script>
Advertisement
Add Comment
Please, Sign In to add comment