Jump to content

Recommended Posts

Hi Guys

 

I wonder if someone can help.

 

Essentially it's a jquery script that makes a scrolling div track the page. So when you scroll down the page the div follows you. That works fine.

 

The issue is that if a user clicks back, or forward on the iPad the jquery seems to simply fail and the scroll event stops working.

 

I tried to strip the page down to test this with just a straight alert as follows:

 

$(document).ready(function(){
alert(1);
});

 

This code fires fine on page load and alerts 1, but if I then navigate away, and then click back, the alert doesnt fire.

 

I am guessing this is a caching issue but I was wondering if anyone had encountered this problem and what the best solution is?

 

Any advice welcome as iPad design is all very new to me.

 

Drongo

Link to comment
https://forums.phpfreaks.com/topic/268827-jquery-and-ipad-issue/
Share on other sites

In that case I'd add a JS to check on scroll, which checks of the page is at top/bottom (or # pixels away from it), and then suitably adjusts the position of the div.

If the browser clears out the JS events when going to a new page, and doesn't load them anew when going back in the history, there's little you can do about it. The only recourse you have is to check an event handler which it does fire, and hopefully is directly related to what you want.

Sorry I realise this is all a bit abstract.

 

I had hoped it would be a known issue with a known solution. The problem is even if I did re-detect the element's position, and reset it, the actual scroll event simply doesnt work when you click back.

 

This is a toughy :/ as even the simple jquery alert in my example didn't work.

 

Do you think I'd have more luck with straight javascript? Would an onload function get preserved perhaps? I realise the ready event is similar.

 

hmmm

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.