Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Photography</title>
<link href="stylesheet2.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Bad+Script|Kaushan+Script|Poiret+One'  rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="gallery.js"></script>
<!--METADATA-->
<meta name="description" content="A digital portfolio page showcasing Chloe Hammond's most recent projects from her New Media degree course at the University of Leeds. "/>
<meta name="keywords" content="chloe, hammond, portfolio, digital, new, media, experience, contact, work, university, student, leeds, intern, internship, freelance"/>
</head>
<body>
<div class="wrapper">
<div class="navigation"> 
    <h2><ul>
        <li><a href="portfolio.html">Portfolio</a>  
            |
            <ul>
            <li><a href="design.html">Design</a></li>
            <li><a href="photo.html">Photo</li>
            <li><a href="motion.html">Motion</li>
            <li><a href="web.html">Web</li>&nbsp;|
         </ul>
         </li>
        <li><a href="about2.html">About</a></li>
         |
        <li><a href="contact2.html">Contact</a></li> 
    </ul></h2>
    </li></div>
    &nbsp;
    
    <div class="social-sidebar-buttons"   
 
     <a href="http://www.facebook.com/chloe.hammond.7"><img src="http://me14ch.leedsnewmedia.net/portfolio/facebook2.png" target="_blank" alt="Connect with Chloe on Facebook"/></a>                                              
  <a href="https://twitter.com/ChloeHammondx" title="twitter"><img src="http://me14ch.leedsnewmedia.net/portfolio/twitter2.png" target="_blank" alt="Connect with Chloe on Twitter" /></a>
<a href="https://instagram.com/chloelouisehammond/" title="Instagram"><img src="http://me14ch.leedsnewmedia.net/portfolio/instagram2.png" target="_blank" alt="View Chloe's Instagram feed" /></a>
<a href="mailto:chloehammond@live.co.uk" title="email"><img src="http://me14ch.leedsnewmedia.net/portfolio/mailto2.png" target="_blank" alt="Email Chloe" /></a> 
    </div> 
    
    <div class="titles"><h1>Photo</h1></div>
    
    <div class="main-content">
    <ul>
    <li> TRAVEL
    <h2>(click on the box to expand gallery)</h2>
<div class="wrap">
  <div id="picture1" class="deck"> 
      <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork1.JPG">
      </a>
    </div>
  <div id="picture2" class="deck">
      <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork2.JPG">
      </a></div>
  <div id="picture3" class="deck"> 
      <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork3.JPG">
      </a></div>
  <div id="picture4" class="deck">
      <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork4.JPG">
      </a></div>
  <div id="picture5" class="deck">
      <img src="http://www.me14ch.leedsnewmedia.net/portfolio/gallery/newyork5.JPG">
      </a></div>
</div>
      <div id="close"><p>&laquo; collapse gallery</p></div>
      
      <div id="lightbox">
    <div id="lightwrap">
     <div id="x"></div>
    </div>
</div>
    
    
    
    
    </li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    </ul>
  
    
    
    </div>
<body>
</body>
</html>
 
$( document ).ready(function() {
  //paste javascript code here
  var i, expand = false;
function reset() {
  $('.deck').css({
    'transform': 'rotate(0deg)',
    'top'      : '0px'
  });
}
//expands and contracts deck on click
$('.deck').click(function (a) {
  if (expand) {
    a.preventDefault();
    var imgSource = $(this).children().attr('href');
    $('#lightwrap').append('<img src="' + imgSource + '" id="lb-pic">');
    $('#lightbox, #lightwrap').fadeIn('slow');
  } else {
    var boxWidth = $('.deck').width();
    $('.deck').each(function (e) {
      $(this).css({
        'left': boxWidth * e * 1.1 + 'px'
      });
      expand = true;
      $('#close').show();
    });
  }
});
//close lightbox
$('#x, #lightbox').click(function(){
  $('#lightbox').fadeOut('slow');
  $('#lightwrap').hide();
  $('#lb-pic').remove();
});
//prevent event bubbling on lightbox child
$('#lightwrap').click(function(b) {
  b.stopPropagation();
});
$('#close').click(function(){
  $(this).hide();
  $('.deck').css({'left': '0px'});
  expand = false;
});
$('.deck:last-child').hover(
  //random image rotation 
  function() {
    if (expand === false) {    
      $('.deck').each(function () {
        i++;
        if (i < $('.deck').length) {
          var min = -30,
              max = 30,
              random = ~~(Math.random() * (max - min + 1)) + min;
          $(this).css({
            'transform' : 'rotate(' + random + 'deg)',
            'top'       : random + 15 + 'px'
          });
        }
      });
    }
  //straightens out deck images when clicked
  $('.deck').click(
    function (a) {
      a.preventDefault();
      reset();
    }); 
  },
  //undo image rotation when not hovered
  function () {
    i = 0;
    reset();
  }
);
  
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers