moppie Posted February 8, 2011 Share Posted February 8, 2011 HelloYesterday i had put a question in a other topic but i have found a solution i only dont know how to intergratie itthis was my questioni hope someone can help me, i want a picture as background, so far no trouble but i want the picture to show on al browsers and all resolutionbut then i got a problem because the picture is not showing when someone has a small screen, is there a way to make sure the hwole picture is also showing with al smal screen?i have included the pictures screen 1 is how a want it and screen 2 is with small screenI have found a solution but i don't know where en how i can integrate it )jquery)this could be the solution is there someone who can helpe where i have to put these codes in witch files etc?first code: seccond code; #bg { position: fixed; top: 0; left: 0; } .bgwidth { width: 100%; } .bgheight { height: 100%; } third code $(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(function() { resizeBg(); }).trigger("resize"); }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now