Skip to content

Instantly share code, notes, and snippets.

@jillmugge
Last active October 13, 2016 17:42
Show Gist options
  • Save jillmugge/362a557a3593aa3821301ac8843c4eb3 to your computer and use it in GitHub Desktop.
Save jillmugge/362a557a3593aa3821301ac8843c4eb3 to your computer and use it in GitHub Desktop.
Hero full browser screen image. Add #hero to img. enqueue script in functions.php
//Enqueue
add_action( 'wp_enqueue_scripts', 'jmg_enqueue_all' );
function jmg_enqueue_all() {
wp_register_script( 'hero', get_stylesheet_directory_uri().'/js/hero.js');
wp_enqueue_script('hero', get_template_directory_uri().'/js/hero.js', array('jquery'), false, true);
}
jQuery(document).ready(function($){
// Defining a function to set size for #hero
function fullscreen(){
jQuery('#hero').css({
width: jQuery(window).width(),
height: jQuery(window).height()
});
}
fullscreen();
// Run the function in case of window resize
jQuery(window).resize(function() {
fullscreen();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment