Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 527865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:55:40+00:00 2026-05-13T08:55:40+00:00

http://grab.by/1rI8 I wrote some jQuery script so that the background image will always scale

  • 0

http://grab.by/1rI8

I wrote some jQuery script so that the background image will always scale and will never show a blank spot.

    function runIt() {
currentHeight = $("#bg").height() //useless for you
currentWidth = $("#bg").width() //useless for you
ccurrentHeight = $("#cover").height() //useless for you
ccurrentWidth = $("#cover").width() //useless for you
wcurrentHeight = $(window).height() //useless for you
wcurrentWidth = $(window).width() //useless for you
$("#auto").empty() //useless for you
$("#auto").append('BG Current Height:"'+currentHeight+'"Width"'+currentWidth+'"<br \>') //useless for you
$("#auto").append('Cover Current Height:"'+ccurrentHeight+'"Width"'+ccurrentWidth+'"<br \>') //useless for you
$("#auto").append('Window Current Height:"'+wcurrentHeight+'"Width"'+wcurrentWidth+'"') //useless for you
if ($("#bg").height() < $(window).height()) {
//  $("#bg").empty() //useless for you
//  $("#bg").append('<img src="'+imgPath+'" style="height:100%" />') //useless for you
        $("#bg").css({
        width: $("#cover").width(),
        height: "auto"
        })
    }
else {
//  $("#bg").empty() //useless for you
//  $("#bg").append('<img src="'+imgPath+'" style="width:100%" />') //useless for you
        $("#bg").css({
        height: $("#cover").height(),
        width: "auto"
        })
    }
}
setInterval(runIt, 50);

Anyone have any ideas as to why this isn’t working properly?

Thanks,
Switz

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:55:41+00:00Added an answer on May 13, 2026 at 8:55 am
        function runIt() {
     winprop = $(window).height() / $(window).width();
     var bgprop = $("#bgimg").height() / $("#bgimg").width();
     if(winprop < bgprop)
     {
             $("#bgimg").css({
             width: $(window).width(),
             height: "auto"
             })
     } else {
             $("#bgimg").css({
             width: "auto",
             height: $(window).height()
             })
        }
    }
    function doSomething() {
        alert("I'm done resizing for the moment");
    };
     runIt();
    var resizeTimer = null;
    $(window).bind('resize', function() {
        if (resizeTimer) clearTimeout(resizeTimer);
        resizeTimer = setTimeout(runIt, 20);
    });
    

    Give the Bg image to its own id. Change the size of the image, not the div.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to grab an image from an HTTP response in C#, but instead
I grab the filelist ([ http://www.w3.org/TR/FileAPI/#dfn-filelist] ) and then I want to use JQuery's
http://www.e-fluential.com/offline/ Screen grab: I can't get the div that the blue words blah blah
What framework I should use to grab XML from a http and parse that?
I have some special characters here: http://209.141.56.244/test/char.php but when I grab this file via
For example I need to grab from http://gmail.com/ the number of free storage: Over
I am using this URL http://search.twitter.com/search.json to grab tweets with the hash tag #SameHashTag
I was trying to use http://www.jongsma.org/gc/scripts/ofx-ba.py to grab my bank account information from wachovia.
There is an online file (such as http://www.example.com/information.asp ) I need to grab and
http://jqueryui.com/demos/accordion/ You can do $('#itename').accordion('activate', 0) to make an accordion closed but that'll change

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.