Created
          March 12, 2014 20:22 
        
      - 
      
- 
        Save bcalloway/9515492 to your computer and use it in GitHub Desktop. 
    HTML5 localstorage
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <img id="slideImg_2" data-loc="http://c413794.r94.cf1.rackcdn.com/pages/02_intro.jpg" class="load_later" alt="Alta, UT" /> | |
| $('.load_later').each(function (index) { | |
| var target = this; | |
| var id = $(this).attr("id"); | |
| setTimeout(function () { late_image(target, id) }, 1000 + (130 * index)); | |
| }); | |
| function late_image(target, id) { | |
| if ( localStorage.getItem(id)) { | |
| imagesrc = localStorage.getItem(id); | |
| } | |
| else { | |
| imagesrc = $(target).data("loc"); | |
| localStorage.setItem(id, imagesrc); | |
| } | |
| $(target).attr("src", imagesrc); | |
| // var imagesrc = $(target).data("loc"); | |
| // $(target).attr("src", imagesrc); | |
| //console.log('image'); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment