Last active
October 12, 2018 12:52
-
-
Save patrickposner/09bd1d042a9a3bfc3978e735f1391905 to your computer and use it in GitHub Desktop.
do something if viewport width is low
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
| add_action( 'wp_footer', 'hide_model_if_mobile' ); | |
| function hide_model_if_mobile() { | |
| ?> | |
| <script> | |
| jQuery(document).ready(function( $ ) { | |
| var width = $(window).width(); | |
| if ( width <= 768 ) { | |
| $( 'check-viewport' ).css('display', 'none'); | |
| } else { | |
| $( 'check-viewport' ).css('display', 'block'); | |
| } | |
| }); | |
| </script> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment