JQuery Viewport Size
How do I make an jquery viewport size?
Determine browser viewport size on page load and resize. What is a jquery viewport size? How do you make a jquery viewport size? This script and codes were developed by Jeff Pannone on 12 August 2022, Friday.
JQuery Viewport Size - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery Viewport Size</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap"> <p>Your window size is <span class="size"></span><sup>PX</sup></p> <p class="extra"></p>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
JQuery Viewport Size - Script Codes CSS Codes
body { background: #333;
}
.wrap { width: 100%; margin: 100px auto 0; text-align: center;
}
.wrap p { font-size: 2em; display: block; font-family: helvetica, arial, sans-serif; color: #ccc; margin: .5em 0; line-height: 1;
}
.wrap p .size { color: #ff9e00;
}
.wrap p sup { font-size: 14px; margin-left: 5px;
}
JQuery Viewport Size - Script Codes JS Codes
$(window ).on("load resize", function() { var windowWidth = $(window).width(); var htmlOut = '.extra'; $(".size").html(windowWidth); console.log(windowWidth); if(windowWidth >= 1024){ $(htmlOut).html('Desktop'); } else if (windowWidth >= 768){ $(htmlOut).html('Tablet'); } else{ $(htmlOut).html('Phone'); }
});

Developer | Jeff Pannone |
Username | jeffpannone |
Uploaded | August 12, 2022 |
Rating | 3 |
Size | 2,317 Kb |
Views | 26,299 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
URL Parameter Conditional | 1,853 Kb |
Slick dropdown navigation | 5,966 Kb |
Photoswipe Drug Facts | 5,320 Kb |
Magnific - open popup with URL param | 3,607 Kb |
JQuery Division | 1,970 Kb |
Slide Toggle for Adam | 2,764 Kb |
A Pen by Jeff Pannone | 1,716 Kb |
DWSG Templates | 11,029 Kb |
Geolocation API | 1,952 Kb |
Hompage Grid | 5,086 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS Variables | Jdsteinbach | 4,759 Kb |
Vue Transition | Chenming142 | 4,561 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Navier Stoke Fluid Simulation | Esimov | 8,584 Kb |
Faux column absolute wrapper | Yurimorini | 1,823 Kb |
CSS3 Diamond | Rendro | 1,960 Kb |
Motion Lines - codevember - 02 - 2016 | Caiocares | 2,744 Kb |
NgEasyModal | Lorenzodianni | 4,159 Kb |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!