Created
May 2, 2017 21:28
-
-
Save loftywaif002/f3a4eb49095c7652b9837142d71e5331 to your computer and use it in GitHub Desktop.
Mobile Responsive using Javascript -Works fine in Chrome
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
| <script type="text/javascript"> | |
| window.onresize = function(){ | |
| var winWidth = $(window).width(); | |
| switch (true) { | |
| case(winWidth < 370 && winWidth > 350): | |
| console.log("Galaxy Portrait"); | |
| break; | |
| case(winWidth < 645 && winWidth > 638): | |
| console.log("Galaxy Landscape"); | |
| break; | |
| case(winWidth < 420 && winWidth > 405): | |
| console.log("Nexus5X Portrait"); | |
| break; | |
| case(winWidth < 690 && winWidth > 680): | |
| console.log("Nexus5X Landscape"); | |
| break; | |
| case(winWidth < 420 && winWidth > 400): | |
| console.log("Nexus6P Portrait"); | |
| break; | |
| case(winWidth < 740 && winWidth > 725): | |
| console.log("Nexus6P Landscape"); | |
| break; | |
| case(winWidth < 325 && winWidth > 315): | |
| console.log("Iphone 5 Portrait"); | |
| break; | |
| case(winWidth < 575 && winWidth > 565): | |
| console.log("Iphone 5 Landscape"); | |
| break; | |
| case(winWidth < 380 && winWidth > 370): | |
| console.log("Iphone 6 Portrait"); | |
| break; | |
| case(winWidth < 672 && winWidth > 660): | |
| console.log("Iphone 6 Landscape"); | |
| break; | |
| case(winWidth < 418 && winWidth > 410): | |
| console.log("Iphone 6 Plus Portrait"); | |
| break; | |
| case(winWidth < 740 && winWidth > 730): | |
| console.log("Iphone 6 Plus Landscape"); | |
| break; | |
| case(winWidth < 770 && winWidth > 760): | |
| console.log("Ipad Portrait"); | |
| break; | |
| case(winWidth < 1030 && winWidth > 1020): | |
| console.log("Ipad Landscape"); | |
| break; | |
| case(winWidth < 1030 && winWidth > 1020): | |
| console.log("IPad Pro Portrait"); | |
| break; | |
| case(winWidth < 1370 && winWidth > 1360): | |
| console.log("IPad Pro Landscape"); | |
| break; | |
| } | |
| }; | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment