Created
April 20, 2015 03:26
-
-
Save kier0/d585ca9fdf681e455120 to your computer and use it in GitHub Desktop.
Change a button or link to trigger a phone app launch/number dial on a mobile screen size. Example below will change link on screens below 700px w.
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
| <?php wp_enqueue_script('jquery'); ?> | |
| <script type="text/javascript"> | |
| jQuery(document).ready(function() { | |
| // This will fire when document is ready: | |
| jQuery(window).resize(function() { | |
| // This will fire each time the window is resized: | |
| if(jQuery(window).width() <= 700) { | |
| // if smaller or equal | |
| jQuery('a.call-tell-btn').attr("href", "tel:1234567890"); | |
| } else { | |
| } | |
| }).resize(); // This will simulate a resize to trigger the initial run. | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment