JQuery Viewport Size

Developer
Size
2,317 Kb
Views
26,312

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 Previews

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'); }
});
JQuery Viewport Size - Script Codes
JQuery Viewport Size - Script Codes
Home Page Home
Developer Jeff Pannone
Username jeffpannone
Uploaded August 12, 2022
Rating 3
Size 2,317 Kb
Views 26,312
Do you need developer help for JQuery Viewport Size?

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!

Jeff Pannone (jeffpannone) Script Codes
Create amazing art & images with AI!

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!