Resize Div to Fit Screen

Developer
Size
2,662 Kb
Views
28,336

How do I make an resize div to fit screen?

Testing manual width adjustment via jQuery.. What is a resize div to fit screen? How do you make a resize div to fit screen? This script and codes were developed by John Lueders on 20 November 2022, Sunday.

Resize Div to Fit Screen Previews

Resize Div to Fit Screen - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Resize Div to Fit Screen</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 id="big"> <div id="windowInfo"> <h1>Big Header</h1> </div> <div id="hero">hero</div> <button id='read-the-message' class="read-the-message">Message</button> <div class='message'> <h1>Greetings</h1> <p>This is a message</p> <p>Message from Pastor</p> </div>
</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>

Resize Div to Fit Screen - Script Codes CSS Codes

html { background: #333;
}
#big { color: white; overflow: hidden; position: absolute; width: 100%; height: 100%; background: #555; left: 220px;
}
#big p { padding-top: 10px; padding-left: 10px;
}
#hero { background: rgba(0, 0, 0, 0.3); background: url(http://www.placekitten.com/300/300); background-size: cover;
}
button.read-the-message { position: absolute; bottom: 0; left: 20px; color: black; border: 1px solid #ccc; padding: 3px 10px;
}

Resize Div to Fit Screen - Script Codes JS Codes

var windowHasResized = function() { // parseInt is helpful var windowHeight = $(window).height(); $('#big').css('height', windowHeight + 'px'); var $hero = $( "#hero" ); var position = $hero.position(); $hero.height(windowHeight - parseInt(position.top)); //$( "#hero" ).text( "left: " + position.left + ", top: " + position.top + ", height: " + $hero.height() ) ; console.log( "resize" );
}
$(window) .load(windowHasResized) .resize(windowHasResized);
$( '#read-the-message' ).on( 'click', function() { $( this ).css( "color", "red" ); $('#big').css('overflow', 'auto');
});
Resize Div to Fit Screen - Script Codes
Resize Div to Fit Screen - Script Codes
Home Page Home
Developer John Lueders
Username elmsoftware
Uploaded November 20, 2022
Rating 3
Size 2,662 Kb
Views 28,336
Do you need developer help for Resize Div to Fit Screen?

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!

John Lueders (elmsoftware) Script Codes
Create amazing web content 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!