How to manually show login or sign up form?

5 replies · opened Mar 14, 2020

CcloudliuzjMar 14, 2020

Hi,
Sorry to bother. How can I manually set which form to show or hide in Login/Register - style 3?
For example, if someone clicks on register link, the page will show login form closed and register form opened after loaded.
How can I set that?

Thanks for help!

SSemicolon WebSTAFFMar 15, 2020

Hello,

Consider using the following JS Code at the bottom of the Page:


	jQuery(window).on( 'load', function(){
		var windowHash = location.hash;
		if( windowHash != '' && typeof windowHash !== 'undefined' ) {
			var $accordion = $(windowHash).parents('.accordion');
			if( $accordion.length > 0 ) {
				$accordion.find('.acc_content').hide();
				$accordion.find('.acctitle'+ windowHash).addClass('acctitlec').next().show();
			}
		}
	});

and then simply add the id Attribute to the .acctitle Element. Example:


	Login to your Account
	
		..
	

	New Signup? Register for an Account
	
		...
	

Now, you can Link the Page using this Link with a Hash referencing to the ID: login-register-3.html#accordion-register .

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcloudliuzjMar 16, 2020

Hi, Thanks for your reply!
I have added the id attribute and adjust the JS code like below to make it working.

<script>
jQuery(document).ready( function($) {

        let authMode = location.hash;
        if (authMode != '' && typeof authMode !== 'undefined') {
            var $accordion = $("#" + authMode).parents('.accordion');
            if ($accordion.length &gt; 0) {
                $accordion.find('.acc_content').hide();
                $accordion.find('.acctitle').removeClass('acctitlec');
                $("#" + authMode).addClass('acctitlec').next().show();
            }
        }
    });
&lt;/script&gt;

There is another question. I have to put this code after import the functions.js file.
Is there any way I can add this JS code before import the function.js file?

Sincerely,

SSemicolon WebSTAFFMar 16, 2020

Hello,

Unfortunately, not. This has to be put after the js/functions.js JS File Linking to avoid being overridden by the default functions.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcloudliuzjMar 17, 2020

Got it, thanks for helping!

Sincerely,

SSemicolon WebSTAFFMar 17, 2020

Hello,

Very Happy to Help!

Do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard