Last active
April 26, 2016 12:35
-
-
Save srikat/1edba102899bf9b64030 to your computer and use it in GitHub Desktop.
How to hide a widget area after a certain time using jQuery. https://sridharkatakam.com/how-to-hide-a-widget-area-after-a-certain-time-using-jquery/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register before-header widget area | |
genesis_register_sidebar( array( | |
'id' => 'before-header', | |
'name' => __( 'Before Header', 'magazine' ), | |
'description' => __( 'This is the before header section', 'magazine' ), | |
) ); | |
// Display before-header widget area before the header | |
add_action( 'genesis_before_header', 'sk_before_header' ); | |
function sk_before_header() { | |
genesis_widget_area( 'before-header', array( | |
'before' => '<div class="before-header widget-area"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Site Header | |
---------------------------------------------------------------------------------------------------- */ | |
.primary-nav .site-header { | |
padding-top: 64px; | |
} | |
.site-header .wrap { | |
border-bottom: 2px solid #222; | |
padding: 30px 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Site Header | |
---------------------------------------------------------------------------------------------------- */ | |
/*.primary-nav .site-header,*/ | |
.primary-nav .before-header.hidden + .site-header, | |
.primary-nav .before-header { | |
padding-top: 64px; | |
} | |
.before-header .wrap { | |
padding: 30px 0; | |
border-bottom: 1px solid #222; | |
} | |
.site-header .wrap { | |
border-bottom: 2px solid #222; | |
padding: 30px 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Slide down before-header widget area and slide it up out of view after 3s | |
var tId; | |
$(".before-header").hide().slideDown("slow"); | |
clearTimeout(tId); | |
tId=setTimeout(function(){ | |
$(".before-header").slideUp("slow").addClass("hidden"); | |
}, 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment