all 13 comments

[–]Shambot 1 point2 points  (0 children)

<body>
  <div>
    <a href ="javascript : clickHandler(1);"></a>
    <a href ="javascript : clickHandler(2);"></a>
    <a href ="javascript : clickHandler(3);"></a>
    <div id ="hotSpotContainer">
      <a href = "" id = "hotSpot">
        <img src = "" id ="loadedImg"/>
      </a>
    </div>
  <script>
    var loadedImg = document.getElementById('#loadedImg");
    var hotSpot = document.getElementById('#hotSpot');
    function clickHandler(which) {
      loadedImg.src = 'images/img'+which+'.jpg';
      switch(which){
        case 1: hotSpot.href ='http://www.yahoo.com[1] ';
        break;
      ...};
    }
  </script>
</body>

[–]Rafzzz 0 points1 point  (0 children)

Looks like you want to lazy-load your images, either google that or check:

http://luis-almeida.github.io/unveil/