Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Is there a way to reset buttons to off on page change. Basically reset the whole page. I have some buttons that appear within an Mso, they close if the Mso is closed manually via a back button, but if not, when returning to the page, the Mso has reset but the buttons still appear, removing the back button option. Any suggestions to prevent this from happening? Some code to reset all on page would be perfect. Thanks in advance.
in how_to by (230 points)
  

1 Answer

+1 vote
 
Best answer

Update:

Here's code that will reset buttons that were initially hidden (similar to the MSO reset in the link below):

$(function(){
	$('button.hidden').addClass('init-hidden');
	$(document).on('newPage', function(e,data){
		if(nav.previousPageIndex !== undefined) {
			$('.page').eq(nav.previousPageIndex).find('button.init-hidden').addClass('hidden');
			$('.page').eq(data.index).find('button.init-hidden').addClass('hidden');
		}    
	});
});

You might want to check out the discussion in this post to see if the suggested custom .js code would work for you (read the whole thread, as the code was updated): https://ajarproductions.com/pages/products/in5/answers/1735/how-to-reset-multi-state-object-mso-states-on-page-change

by (9.6k points)
selected by
I already have this code in my document. This is what is causing the problem. As you can not have an MSO state call up another MSO state on the same page, the images are set as buttons. So the MSO is resetting as it should, but the buttons remain static. As the MSO has now reset, it also removes the button for closing down the images. It is the buttons I want to reset, not the MSO.
The simplest solution might be to put the buttons in MSO states as well, so that they get reset.
I'm unsure how to achieve that. The MSO are hidden until triggered. Then within that MSO there are buttons to display images. So effectively there would be an MSO inside an MSO and at that point I'm unable to select a different MSO group, hence why I ended up making them buttons. Maybe I'm missing something?
I'm having a hard time picturing it, but if you want to send us your document, we can probably look at and it provide a suggestion:
https://ajarproductions.com/pages/contact.php?category=in5
Yeah, I've probably not explained that amasingly well. Will send files. Thanks
I can confirm that I have used this script and it works perfectly. Many thanks.
Awesome. Glad to hear it. :-)