Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).load(function() {
- var theWindow = $(window),
- $bg = $("#bg"),
- aspectRatio = $bg.width() / $bg.height();
- function resizeBg() {
- if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
- $bg
- .removeClass()
- .addClass('bgheight');
- } else {
- $bg
- .removeClass()
- .addClass('bgwidth');
- }
- }
- theWindow.resize(resizeBg).trigger("resize");
- });
Advertisement
Add Comment
Please, Sign In to add comment