Created
April 2, 2017 14:15
-
-
Save Teckchun/5b455dbf177c77c52982ea74fc2f2b82 to your computer and use it in GitHub Desktop.
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| <script | |
| src="https://code.jquery.com/jquery-3.2.1.js" | |
| integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" | |
| crossorigin="anonymous"></script> | |
| <style> | |
| .test{ | |
| background-color: lightblue; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1 id="myid" class="test">Hello</h1> | |
| <script> | |
| $(document).ready(function(){ | |
| $(window).resize(function(){ | |
| console.log($("body").innerWidth()) | |
| var bodyWidth = $("body").innerWidth(); | |
| if(bodyWidth<1264){ | |
| console.log("working"); | |
| $("#myid").removeClass('test') | |
| }else{ | |
| $("#myid").addClass('test') | |
| } | |
| }) | |
| }) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment