Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd Image always stuck on loading image #79

Closed
wjthomas9 opened this issue Aug 17, 2011 · 29 comments
Closed

3rd Image always stuck on loading image #79

wjthomas9 opened this issue Aug 17, 2011 · 29 comments

Comments

@wjthomas9
Copy link

Hi,

Pretty sweet plugin. Trying to use the exclusive mode with no thumbnails. I'm also using jQuery mobile. It seems no matter what I do, photoswipe always shows a loading indicator for the 3rd image, and it never loads. Your exclusive mode doesn't have an example using jQuery mobile, but I get the idea. I just put the var options in the jQuery document ready. However, even if I use the non-jQuery call, the same exact thing happens. Any ideas?

Thanks,
-Jon

@wjthomas9
Copy link
Author

Now, it appears that it's the last image in the array that is stuck on the loading image. Then, quickly swiping from that last image to another image causes the same issue on the other images. All images get stuck on loading indicator.

@wjthomas9
Copy link
Author

This is also happening on your 09-exclusive-mode-no-thumbnails.html. If you swipe or click through to image 18, it seems to get stuck on the loading image. As I was typing this, image 18 finally loaded, but it seems to be hit or miss on whether the last image in the array ever ends up loading.

@saurori
Copy link

saurori commented Aug 17, 2011

I'm having the same issue and it's holding me back from using this. There really aren't any other good alternatives too.

@codecomputerlove
Copy link
Contributor

I'll look into this and try to replicate. If I can't I'll need an example of you that I can run locally to see what's happening

@codecomputerlove
Copy link
Contributor

sfire thanks for also reporting. Is this exactly the same issue? Have you looked into the code yourself as well to help me with any pointers?

@codecomputerlove
Copy link
Contributor

Well the good news is I've replicated this issue using the "09" example. Can't seem to get it to happen on the other examples. I'm on the case...

@codecomputerlove
Copy link
Contributor

Hopefully fixed this, will release a new version later

@codecomputerlove
Copy link
Contributor

Try v2.0.1

@wjthomas9
Copy link
Author

Great! I'll try it out now and will let you know today if it works for me. Thank you.

@wjthomas9
Copy link
Author

Just wanted to confirm that it works perfect. Thanks for fixing this. Good stuff. :)

@codecomputerlove
Copy link
Contributor

Great. Thanks for reporting this it was a fairly major bug that would have caused other issues.

Thanks

@nate8684
Copy link

nate8684 commented Mar 9, 2012

wjthomas9 do you mind posting a bit of code that you used? I'm trying to do the same things as you but still get stuck on transitions when I leave the page and come back. Any ideas?

@wjthomas9
Copy link
Author

Hi Nate. I'm using the plugin on this page.

http://www.twodo.com/m/gallery/

You could download the js and see if there's anything in there that helps you. If not, let me know.

@nate8684
Copy link

nate8684 commented Mar 9, 2012

Hey wjthomas9 -

Thanks for the reply. I looked briefly at yours and it appears that you're roughly doing the same thing. My problem comes in when you navigate away from the home page (click events), and then click back to the home page, it pauses the slideshow. Do you know why that is happening?

http://lcbcchurch.com/mobile-test/ (Make sure you make the width smaller than the height)

@wjthomas9
Copy link
Author

Which page is your gallery on? I don't see it.

On Mar 9, 2012, at 12:30 PM, nate8684 wrote:

Hey wjthomas9 -

Thanks for the reply. I looked briefly at yours and it appears that you're roughly doing the same thing. My problem comes in when you navigate away from the home page (click events), and then click back to the home page, it pauses the slideshow. Do you know why that is happening?

http://lcbcchurch.com/mobile-test/ (Make sure you make the width smaller than the height)


Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

nate8684 commented Mar 9, 2012

You probably don't see it because you haven't adjust the width of your browser. Make sure the width is smaller than the height. It's right on the home page.

@nate8684
Copy link

nate8684 commented Mar 9, 2012

Also, follow the steps below to make it happen:

  1. Open the page
  2. Click on events
  3. Wait aprx. 5 secs
  4. click on home

@wjthomas9
Copy link
Author

Hmm. This is all I see on the events page: http://cl.ly/2M1I2y3i2f043x2J1M3R

Is that right? I don't see any images.

On Mar 9, 2012, at 1:59 PM, nate8684 wrote:

Also, follow the steps below to make it happen:

  1. Open the page
  2. Click on events
  3. Wait aprx. 5 secs
  4. click on home

Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

nate8684 commented Mar 9, 2012

No, the slideshow should be on the home page. I said to navigate to the events page because it stops the slideshow on the homepage. Does that make sense?

@wjthomas9
Copy link
Author

Oh, ok. I misunderstood. I still don't see slides on the home page when going back to it from the events page. :(

On Mar 9, 2012, at 2:12 PM, nate8684 wrote:

No, the slideshow should be on the home page. I said to navigate to the events page because it stops the slideshow on the homepage. Does that make sense?


Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

nate8684 commented Mar 9, 2012

Hold on, sorry, it's not working for me either

@wjthomas9
Copy link
Author

Getting an error in console: http://cl.ly/2J0h2v2n1E1P3U302L0g

On Mar 9, 2012, at 2:13 PM, nate8684 wrote:

Hold on, sorry, it's not working for me either


Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

nate8684 commented Mar 9, 2012

Ahh, the ajax call won't work on a server. Basic gist is this:

When I navigate away from the home page (where the slideshow is) then go back to it, the slideshow freezes in the middle of a transition. The only way it works again is if I refresh it.

Any thoughts?

Sorry for the confusion.

@nate8684
Copy link

nate8684 commented Mar 9, 2012

FYI - This is a native phone app so I'm not too worried about it working in a server environment.

@wjthomas9
Copy link
Author

Sounds like maybe you need to re-initialize the call for the plugin every time you load the home page. I'm not sure why I don't have that issue. If you're using jquery mobile, there should be a callback for after you navigate to a page. Maybe you can fire the call to the plugin again in that callback?

On Mar 9, 2012, at 2:20 PM, nate8684 wrote:

FYI - This is a native phone app so I'm not too worried about it working in a server environment.


Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

nate8684 commented Mar 9, 2012

Yeah, I guess that's what I'm struggling with currently right now. I've customized the code a bit, so it's a little complicated to try to figure that out. Here is what I have right now:

<script type="text/javascript">

    // ---------- AJAX JSON CALL ----------------    
    $.ajax({
        url: "http://www.lcbcchurch.com/mobileJSON/homeslideshow",
        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.
            // Adding the JSON to the HTML
            $("#slider").append("<a href='"+data[i].slideshow_image+"'></a>");
        }
        // Call the pics ready function
        picsReady();
        }
    // ---------- FORM THE SLIDER ----------------             
    function picsReady() {


        (function(window, Util, PhotoSwipe){
            $(document).ready(function(e){


                    var 
                    currentPage = $(e.target),
                    homeSlider;
                    homeSlider = PhotoSwipe.attach(
                    window.document.querySelectorAll('#slider a'),
                    {
                        target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
                        loop: true,
                        preventHide: true,
                        autoStartSlideshow: true,
                        captionAndToolbarHide: true,
                        margin: 0,
                    }
                    ); // PhotoSwipe.attach         
                    homeSlider.show(0);     
                    return true;        

            }); // $(document).ready(function(e){
        }(window, window.Code.Util, window.Code.PhotoSwipe)); // function(window, util, PhotoSwipe)






     } // function picsReady()   



         </script>

I know that I can use something like this:

$('#home').live('pageshow', function(e){

but I'm not quite sure how to get to deactivate the current instance...

@wjthomas9
Copy link
Author

I'm thinking you could try to use the callback of the jQuery mobile pageoad event.

http://jquerymobile.com/demos/1.1.0-rc.1/docs/api/events.html (scroll down to, or search for pageload)

However, in looking at the top of that page of jQuery mobile documentation, it looks like there are other options that are preferable to using $(document).ready(function(){});

At the top of the page in the link I included above, it talks about using pageInit() instead of $(document).ready(...), since the jQuery mobile pages are loaded via ajax instead of actual new page loads.

-Jon

On Mar 9, 2012, at 2:52 PM, nate8684 wrote:

Yeah, I guess that's what I'm struggling with currently right now. I've customized the code a bit, so it's a little complicated to try to figure that out. Here is what I have right now:

<script type="text/javascript">

   // ---------- AJAX JSON CALL ----------------    
  $.ajax({
      url: "http://www.lcbcchurch.com/mobileJSON/homeslideshow",
      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.
          // Adding the JSON to the HTML
          $("#slider").append("<a href='"+data[i].slideshow_image+"'></a>");
      }
      // Call the pics ready function
      picsReady();
      }
   // ---------- FORM THE SLIDER ----------------             
  function picsReady() {


          (function(window, Util, PhotoSwipe){
          $(document).ready(function(e){


                  var 
                  currentPage = $(e.target),
                  homeSlider;
                  homeSlider = PhotoSwipe.attach(
                  window.document.querySelectorAll('#slider a'),
                  {
                      target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
                      loop: true,
                      preventHide: true,
                      autoStartSlideshow: true,
                      captionAndToolbarHide: true,
                      margin: 0,
                  }
                  ); // PhotoSwipe.attach         
                  homeSlider.show(0);     
                  return true;        

          }); // $(document).ready(function(e){
      }(window, window.Code.Util, window.Code.PhotoSwipe)); // function(window, util, PhotoSwipe)






    } // function picsReady()   



        </script>

I know that I can use something like this:

$('#home').live('pageshow', function(e){

but I'm not quite sure how to get to deactivate the current instance...


Reply to this email directly or view it on GitHub:
#79 (comment)

Jon Thomas
Clearfire Inc
www.clearfirestudios.com
jon@clearfirestudios.com
phone: 217-638-2636

@nate8684
Copy link

Thanks for the continued help. I'm so close I can smell it. Below is how the documentation is telling me to do it. The problem being though, is that it can't find the variable "homeSlider" in the "pagehide" portion of the code and therefore it's not closing the instance as it leaves the page. Any ideas on what I'm doing wrong here, let me know. Thanks!

    // ---------- AJAX JSON CALL ----------------    
    $.ajax({
        url: "http://www.lcbcchurch.com/mobileJSON/homeslideshow",
        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.
            // Adding the JSON to the HTML
            $("#slider").append("<a href='"+data[i].slideshow_image+"'></a>");
        }
        // Call the pics ready function
        picsReady();
        }
    // ---------- FORM THE SLIDER ----------------             
    function picsReady() {


        (function(window, Util, PhotoSwipe){
            $(document).ready(function(){

                $('#home').live('pageshow', function(e){    

                    var 
                    currentPage = $(e.target),
                    homeSlider;
                    homeSlider = PhotoSwipe.attach(
                    window.document.querySelectorAll('#slider a'),
                    {
                        target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
                        loop: true,
                        preventHide: true,
                        autoStartSlideshow: true,
                        captionAndToolbarHide: true,
                        margin: 0,
                    }
                    ); // PhotoSwipe.attach         
                    homeSlider.show(0);     
                    return true;    

                }).live('pagehide', function(e){

                    var 
                    currentPage = $(e.target),
                    homeSlider = PhotoSwipe.getInstance(currentPage.attr('id'));

                    if (typeof homeSlider != "undefined" && homeSlider != null) {
                        PhotoSwipe.detatch(homeSlider);
                    }

                    return true;

                }); 

            }); // $(document).ready(function(e){
        }(window, window.Code.Util, window.Code.PhotoSwipe)); // function(window, util, PhotoSwipe)

@wjthomas9
Copy link
Author

Sorry about the delay.

Could it be because you have a comma instead of a semicolon here?

var
currentPage = $(e.target),

Jon Thomas
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, March 12, 2012 at 10:01 AM, nate8684 wrote:

Thanks for the continued help. I'm so close I can smell it. Below is how the documentation is telling me to do it. The problem being though, is that it can't find the variable "homeSlider" in the "pagehide" portion of the code and therefore it's not closing the instance as it leaves the page. Any ideas on what I'm doing wrong here, let me know. Thanks!

// ---------- AJAX JSON CALL ---------------- 
$.ajax({
url: "http://www.lcbcchurch.com/mobileJSON/homeslideshow",
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.
// Adding the JSON to the HTML
$("#slider").append("<a href='"+data[i].slideshow_image+"'></a>");
}
// Call the pics ready function
picsReady();
}
// ---------- FORM THE SLIDER ---------------- 
function picsReady() {
(function(window, Util, PhotoSwipe){
$(document).ready(function(){
$('#home').live('pageshow', function(e){ 
var 
currentPage = $(e.target),
homeSlider;
homeSlider = PhotoSwipe.attach(
window.document.querySelectorAll('#slider a'),
{
target: window.document.querySelectorAll('#PhotoSwipeTarget')[0],
loop: true,
preventHide: true,
autoStartSlideshow: true,
captionAndToolbarHide: true,
margin: 0,
}
); // PhotoSwipe.attach 
homeSlider.show(0); 
return true; 
}).live('pagehide', function(e){
var 
currentPage = $(e.target),
homeSlider = PhotoSwipe.getInstance(currentPage.attr('id'));

if (typeof homeSlider != "undefined" && homeSlider != null) {
PhotoSwipe.detatch(homeSlider);
}

return true;

}); 
}); // $(document).ready(function(e){
}(window, window.Code.Util, window.Code.PhotoSwipe)); // function(window, util, PhotoSwipe)

Reply to this email directly or view it on GitHub:
#79 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants