• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Hi,

I would like to know how I can disable the automatic scroll to top function that is always fired on page reload.This is really handy in some situations, but actually it conflicts when using waypoints and I would like to disable it permanently.
Wouldn't that be a very good option for the export settings to choose it via checklist? In addition the loading content container sometimes is not wanted, so this would also be very handy to turn off during export dialogue.

I hope you have a quick solution for me.

here is one example where you can see the conflict between the automatic scroll to top function and the waypoints function I embedded.

http://art-design.de/onlineprospekt/demo/

Just scroll a bit down and then hit the page reload button and you will notice the waypoints function does not work properly anymore, as it does not stay in the right place.

 

Looking forward to your kind solution.

Best, Pino.
in how_to by (230 points)
    

1 Answer

0 votes
 
Best answer

For the scrolling, try adding a .js file to the Resources section of the in5 dialog with the following code:

useBookmark = true;

That will store the last page viewed, on reload it will return to that page instead of the first page.

Do you find that your readers hit reload often?


Alternatively, you could set your waypoint code so that it's not triggered until after the scroll occurs. One way to do so would be to delay that code by 1 second.

<script type="text/javascript">
	$(window).load(function(){
           setTimeout(function(){
		$('.finger').each(function(){
			$(this).waypoint(function() {
				$(this).fadeIn(200);
				setInterval(function(elem){
					elem.animate({ top: '-=12px' }, 400);
					elem.animate({ top: '+=12px' }, 400);
				}, 1000,$(this));
			}, {offset: "70%", triggerOnce: true }).fadeOut();
		});
           }, 1000);
	});
    </script>

I understand that it would be nice to have this and the loading message as options in the dialog. If we can find a way to add these without cluttering the dialog for the majority of users, we will.

 

by (183k points)
selected by
The first solution does not seem to work. Maybe because I chose not to cache anything?
I did not implement this code from within the export settings, but I added it by hand. Nothing happens at all. Wouldn't it just be possible to get rid of the scroll to top on page load function somehow?
The other solution with the timeout is working perfectly fine. Thanks for the effort. I still wonder, if possible to turn off the scroll to top function.
The scrollTop function is part of the document initialization, which includes defining the active page. An "active" page is required to trigger auto play elements, among other things. By default, when the page is loaded, the first page should be active.

Since the issue is related to added code, I think the timeout in the additional code probably the best approach.