Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. var image = document.getElementsByClassName('image');
  2. var mainImage = document.getElementById('main-image');
  3.  
  4. image.forEach(function(img){
  5. img.onclick = function(){
  6. mainImage.src = img['data-whatever'];
  7. };
  8. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement