title: My css3 transitions and JSON are clunky
body: <p>I'm trying to create a slide out panel for my navigation for an ios app using phonegap. The problems occur when I get to the page below and the JSON starts loading. First of all I get this error in the console of xcode:</p>
  
  <pre><code>  ImageIO: &lt;ERROR&gt;  JPEG Corrupt JPEG data: premature end of data segment
  </code></pre>
  
  <p>After all the images load, my css3 transition is really choppy, even though it runs smoothly on every other page. What I'm wondering is if the AJAX script is constantly going out and trying to retrieve those images that have errors. Therefore I have an unending script that is causing ios to run choppy. Is there a way to close the script after it retrieves the images or do you have another idea on how to fix this? Here is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
  
          &lt;title&gt;&lt;/title&gt;
  
           &lt;link type="text/css" rel="stylesheet" href="styles/iphone.css" /&gt; 
          &lt;link href="styles/slideshow.css" type="text/css" rel="stylesheet" /&gt;
  
  
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /&gt;
  
              &lt;script type="text/javascript" charset="utf-8" src="scripts/jquery.js"&gt;&lt;/script&gt;
              &lt;script src="scripts/retina.js" type="text/javascript"&gt;&lt;/script&gt; 
              &lt;script type="text/javascript" src="scripts/phonegap.js"&gt;&lt;/script&gt;
  
  
  
  
                &lt;link rel="stylesheet" media="all and (orientation:landscape)" href="styles/iphone-lan.css"&gt;  
  
  
  
              &lt;/head&gt;
  
    &lt;body&gt;
    &lt;div id="overlay"&gt;&lt;/div&gt;
    &lt;div class="wrapper"&gt;
  
  
  &lt;img src="img/events.png" width="280" height="57" class="retina welcome" /&gt;
  &lt;div id="events"&gt;
  
  &lt;/div&gt;
  
  
  &lt;/div&gt;
  
  
  
  
  &lt;div id="nav-wrapper"&gt;
  &lt;ul&gt;
  &lt;li class="home"&gt;&lt;a  href="index.html"&gt;&lt;div&gt;&lt;img src="img/home-icon-white.png" /&gt;&lt;/div&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;li class="where"&gt;&lt;a href="where.html"&gt;&lt;div&gt;&lt;img src="img/where-icon-gray.png" /&gt;&lt;/div&gt;Where&lt;/a&gt;&lt;/li&gt;
  &lt;li class="series"&gt;&lt;a href="watch.html"&gt;&lt;div&gt;&lt;img src="img/watch-icon-gray.png" /&gt;&lt;/div&gt;Series&lt;/a&gt;&lt;/li&gt;
  &lt;li class="events"&gt;&lt;a class="active" href="events.html"&gt;&lt;div&gt;&lt;img src="img/events-icon-gray.png" /&gt;&lt;/div&gt;Events&lt;/a&gt;&lt;/li&gt;
  &lt;li class="more" &gt;&lt;a href="javascript:void(0)" id="more-toggle" &gt;&lt;div&gt;&lt;img src="img/more-icon.png" /&gt;&lt;/div&gt;More&lt;/a&gt;&lt;/li&gt;
  &lt;li id="more-panel"&gt;
  &lt;a class="more-link" href="" style="border-top: none"&gt;READ 2012&lt;/a&gt;
  &lt;a class="more-link" href=""&gt;Blog&lt;/a&gt;
  &lt;a class="more-link" href=""&gt;Facebook&lt;/a&gt;
  &lt;a class="more-link" href=""&gt;Twitter&lt;/a&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/div&gt;
  
  &lt;script&gt;
  $('#more-toggle').click(function() {
      $('#overlay').toggleClass("activated");
      $('#nav-wrapper').toggleClass("expanded");
  });
  &lt;/script&gt;
  
            &lt;script type="text/javascript"&gt;
                  $(document).ready(function() { 
                                    $('img').retina(); 
                                    }); 
  
                  $.ajax({
                         url: "http://www.lcbcchurch.com/mobileJSON/events",
                         dataType: "json",
                         success:function(data){
                         results(data);
                         }
                         });
  
                  function results(data) {
                      for(var i = 0; i&lt;data.length;i++){
                          // this will log all of the images url
                          console.log(data[i].slideshow_image); // just access the part you want by it's name.
                          $("#events").append("&lt;img src='"+data[i]["event-image"]+"'&gt;&lt;/a&gt;");
                      }
                      picsReady();
                  }
                  &lt;/script&gt;
  
  
              &lt;script type="text/javascript" src="scripts/klass.min.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" src="scripts/code.photoswipe-3.0.4.min.js"&gt;&lt;/script&gt;
  
              &lt;script type="text/javascript"&gt;
              function picsReady() {
                  (function(window, Util, PhotoSwipe){
                   $(document).ready(function(e){
                                        var instance;
                                        instance = PhotoSwipe.attach(
                                              window.document.querySelectorAll('#slider a'),
                                              {
                                              target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
                                              loop: true,
                                              preventHide: true,
                                              autoStartSlideshow: true,
                                              captionAndToolbarHide: true,
                                              margin: 0,
                                              }
                                              );          
                                        instance.show(0);
                                        }, false);
                   }(window, window.Code.Util, window.Code.PhotoSwipe));
                   }
  
  
  
                  &lt;/script&gt;
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>