1

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:

  ImageIO: <ERROR>  JPEG Corrupt JPEG data: premature end of data segment

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:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <title></title>

         <link type="text/css" rel="stylesheet" href="styles/iphone.css" /> 
        <link href="styles/slideshow.css" type="text/css" rel="stylesheet" />


<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

            <script type="text/javascript" charset="utf-8" src="scripts/jquery.js"></script>
            <script src="scripts/retina.js" type="text/javascript"></script> 
            <script type="text/javascript" src="scripts/phonegap.js"></script>




              <link rel="stylesheet" media="all and (orientation:landscape)" href="styles/iphone-lan.css">  



            </head>

  <body>
  <div id="overlay"></div>
  <div class="wrapper">


<img src="img/events.png" width="280" height="57" class="retina welcome" />
<div id="events">

</div>


</div>




<div id="nav-wrapper">
<ul>
<li class="home"><a  href="index.html"><div><img src="img/home-icon-white.png" /></div>Home</a></li>
<li class="where"><a href="where.html"><div><img src="img/where-icon-gray.png" /></div>Where</a></li>
<li class="series"><a href="watch.html"><div><img src="img/watch-icon-gray.png" /></div>Series</a></li>
<li class="events"><a class="active" href="events.html"><div><img src="img/events-icon-gray.png" /></div>Events</a></li>
<li class="more" ><a href="javascript:void(0)" id="more-toggle" ><div><img src="img/more-icon.png" /></div>More</a></li>
<li id="more-panel">
<a class="more-link" href="" style="border-top: none">READ 2012</a>
<a class="more-link" href="">Blog</a>
<a class="more-link" href="">Facebook</a>
<a class="more-link" href="">Twitter</a>
</li>
</ul>

</div>

<script>
$('#more-toggle').click(function() {
    $('#overlay').toggleClass("activated");
    $('#nav-wrapper').toggleClass("expanded");
});
</script>

          <script type="text/javascript">
                $(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<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("<img src='"+data[i]["event-image"]+"'></a>");
                    }
                    picsReady();
                }
                </script>


            <script type="text/javascript" src="scripts/klass.min.js"></script>
            <script type="text/javascript" src="scripts/code.photoswipe-3.0.4.min.js"></script>

            <script type="text/javascript">
            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));
                 }



                </script>


  </body>
</html>
nate8684
  • 539
  • 1
  • 9
  • 27
  • When you open your images in Preview do they look fine? corrupt images often have blocks of solid gray in the bottom. If so, try replacing these assets first. – methodofaction Feb 24 '12 at 06:07
  • Possible duplicate of [iPhone - Corrupt JPEG data for image received over HTTP](https://stackoverflow.com/questions/1064920/iphone-corrupt-jpeg-data-for-image-received-over-http) – Paul Sweatte Jul 11 '17 at 02:01

0 Answers0