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 8209831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:51:53+00:00 2026-06-07T09:51:53+00:00

I’ve gotten myself into a jiffy here. I’m building a site with a loaded

  • 0

I’ve gotten myself into a jiffy here.
I’m building a site with a loaded background on each page (even though i’m compressing these to less than 250k, i’m dealing with super long load times with all the other images being loaded on each page. My first attempt to deal with this (especially on the iPhone) was to precache or preload these backgrounds, but the lag is still too long with any type of wireless connect, so my goal here is to load a smaller version of the background for different devices.
I’m hoping someone here can help me find some type of solution.

Currently I’m loading backgrounds through an if (is_page()) elseif (is_page()) statement with the javascript for ez bg resize passing the image for each page.

<?php
if( is_page('About') ) { $img = 'images/img1.jpg'; }
elseif( is_page('Home') ) { $img = 'images/img2.jpg'; }
elseif( is_page('Page_Name') ) { $img = 'images/img3.jpg'; }
elseif( is_page('Videos') ) { $img = 'images/img4.jpg'; }
else { $img = 'images/img5.jpg'; }
?>
<script type="text/javascript">
$("body").ezBgResize({
    img     : "<?php echo $img; ?>",
    opacity : 1,
    center  : true
});
</script>

What i’d like to do is include some type of variable that says
“If is this page, show this image, if is iphone / ipad version, show this image”

  • 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-06-07T09:51:55+00:00Added an answer on June 7, 2026 at 9:51 am

    You should definitely do this client-side, because you have access to the actual screen size via Javascript, instead of doing user-agent sniffing. Especially if you rely on Javascript for your background anyway, using ezBgResize.

    You can check the screen resolution of the device and then have ezBgResize use a high or low resolution version of the image. Check out the random background example for ezBgResize and this post on Javascript media queries for inspiration.

    It could go like this:

    /* This is an example for just one page, expand to your needs */
    
    // Save the two (or more) different size image file names
    var aboutPageBackgrounds = ["image1high.jpg", "image1low.jpg"];
    
    // Check if we are on the about page (assuming an id is set on some element)
    if( $("#aboutpage").length ) {
        // Use the high res version by default
        var image = aboutPageBackgrounds[0];
    
        // Switch to the low res version if the screen is small
        if( screen.width < 600 ) {
            image = aboutPageBackgrounds[1];
        }
    
        // Call ezBgResize with the resulting image path
        $("body").ezBgResize({
            img     : image,
            opacity : 1,
            center  : true
        });
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from

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.