Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #643909

    laurendevine
    Participant

    Hey folks!
    Is there a way I can force the header widget to show as open when a user lands on the website home page? Then…if they click the “plus” icon at that point, it will then close or open (to remain a toggle function).

    I only found something in the forum where it is permanently forced open…but we want the user to be able to close it.

    OR…even better…possible for it to be open upon entry…then after a certain number of seconds…it eases closed? That’d be awesome.

    Thanks, in advance, for any help or advice you can give us!

    #644143

    John Ezra
    Member

    Hi there,

    Thanks for writing in! Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Once you have your child theme setup, please find the _header.php file in the following location:

    /wp-content/themes/x/framework/views/global/_header.php

    Copy this file and paste it into the same directory within the child theme

    /wp-content/themes/x-child/framework/views/global/_header.php

    Next open this file in your code/text editor and add the following line of code:

    <?php x_get_view( 'global', '_header-widget-areas' ); ?>

    Add it directly above <div id="top" class="site">

    Save the file and close it.

    You then need to add this under Custom > Javascript in the Customizer.

    jQuery ( function($) {
    
    $(document).ready ( function() {
    $('.x-btn-widgetbar').trigger('click');
    } );
    
    } );

    Hope this helps – thanks!

    #654591

    laurendevine
    Participant

    Excellent work! BUT, what I realize, now, is that this is permanently covering the main menu or sticky menu.

    Is there more script we can add to have this section auto-close after “x” number of milliseconds or whatever?

    Otherwise, the code that you gave me works perfectly, so thank you.
    And YES, we are already using a child theme πŸ™‚

    #654594

    laurendevine
    Participant

    OH additionally, I just realized it “pops open” whenever you visit any page. We only want it to pop open upon initial entry to the home page along with auto-closing (ease close) after “X” number of milliseconds.

    Possible?

    #654741

    Rad
    Moderator

    Hi there,

    You may try this one πŸ™‚

    jQuery ( function($) {
    
    $(document).ready ( function() {
    
    $('.home .x-btn-widgetbar').trigger('click');
    
    setTimeout( function() { $('.home .x-btn-widgetbar').trigger('click'); }, 3000 );
    
    } );
    
    } );

    And 3000 is equivalent to 3 seconds πŸ™‚

    Cheers!

    #662998

    laurendevine
    Participant

    That was EXCELLENT. Worked like a charm. Thank you VERY much. πŸ™‚ Excellent theme…excellent support πŸ™‚ 5 stars!

    #663124

    Prasant Rai
    Moderator

    We’re delighted to assist you with this.