Last active
October 13, 2016 17:42
-
-
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
This file contains hidden or 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
//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); | |
} |
This file contains hidden or 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
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