Automatic Open Cover

  • Posted in : BookCard
  • chatsmit
    Participant

    Hi, first; thanks for this very nice template, good job!

    I Have question, is there a simple way (think javascript?) to automatically open the Cover page (after a few seconds) when visitors not pressing the Open button…

    I Hate to say, but there are visitors don’t knowing to press that simple button (and think is this all?!).

    Mehmet S.
    Keymaster

    Trigger the Open button click event. And use javascript Delay function for a few seconds.

    chatsmit
    Participant

    Ok thanks, i’m not used to Javascript.. Can read it a little, but that’s all. Sounds logic, but can’t do it. Nevermind, i trie it another time.

    Mehmet S.
    Keymaster

    Add the following code before the end tag of body in index.html file like this:

    	<script>
    		jQuery(document).ready(function($)
    		{
    			var $container = $( '#rm-container' );
    			
    			openMenu = function()
    			{
    				$container.removeClass('rm-closed');
    				setTimeout(function() { $container.addClass( 'rm-open' ); },10);
    			}
    			
    			setTimeout( openMenu(), 5000 ); // Tip: 5000 ms = 5s
    		});
    	</script>
    </body>
    
    optinaut
    Participant

    Mehmet: You should probably change your script or you will make the cover open so quickly that it’s impossible to read everything.

    Line 9:
    setTimeout(function() { $container.addClass( 'rm-open' ); },10);

    Doesn’t ten milliseconds seem a little quick?

    setTimeout(function() { $container.addClass( 'rm-open' ); },5000);

    seems more functional.

    Also, was your intent to render the open ribbon non-functioning?

    Mehmet S.
    Keymaster

    Thank you

    brooklynkid
    Participant

    Hi, I tried this code, but it seems to breaks the mobile version? It opens into a blank screen on the mobile layout. Is there a fix for this? I really appreciate them assistance on this. Thanks!

    ahmetsali
    Keymaster

    @brooklynkid

    try this one;

    <script>
    	jQuery(document).ready(function($)
    	{
    		setTimeout( function() { $('.rm-button-open').trigger('click') } , 1000 ); // Tip: 1000 ms = 1s
    	});
    </script>
    
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register