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

  • SEARCH
  • Home
  • 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 7612219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:51:17+00:00 2026-05-31T01:51:17+00:00

Hi I am currently using jQuery to load a variable php layout depending on

  • 0

Hi I am currently using jQuery to load a variable php layout depending on the browser width.

function setLocation(url) {
   if (window.location.href.indexOf(url) === -1)
      window.location = url;
}

function reloadPage(width) {
    width = parseInt(width);
    if (width < 701) {
        setLocation("yournarrowpage.php");
    } else if (width < 900) {
        setLocation("yourmediumpage.php");
    } else {
        setLocation("yourwidepage.php");
    }
}

$(function() {
   reloadPage($(this).width());
   $(window).resize(function() {
       reloadPage($(this).width());
   });
});

Is it possible to accomplish this with just php?

If yes, how? Please help.

Why do I want to do this when I can simply re-arrange my layout with CSS?

I do not want to use the CSS property #div { display:none } as the issue is that my layouts are loaded with very many images, javascript and also widgets.

I even tried a responsive layout but unfortunately some of the image details are hardly visible in small screens.

Using css property display:none, will still loads the un-displayed content wasting a lot of bandwidth. Lets say for a mobile browser to load 1.5 MB of site and then hide 1.2 MB of it???? Well that may not be a good idea.

For smaller browsers these widgets will not make any sense, hence I would want to load a lighter version of the same.

This is what I think. Please feel free to correct me if I am wrong as I am still a novice when it comes to programming and am still in the learning stage.

  • 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-31T01:51:19+00:00Added an answer on May 31, 2026 at 1:51 am

    Combine CSS media queries and javascript to prevent loading of the larger items/areas you don’t want to load…

    if ($('window').width() > 1000) {
    
     // load your full functions and stylesheet 
    
    }
    
    if ($('window').width() < 1000) {
    
     // load your narrow functions and stylesheet 
    
    }
    

    I’ve recently combined css media queries in a method similar to this, and then added animations to help make the transition less painful.. it’s quite nice.

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

Sidebar

Related Questions

I'm using the JQuery AJAX function to deliver data to a PHP doc. Currently,
Currently I am using jQuery to choose what my index page should load depending
I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to
I am trying to load a part of the page using jQuery load function
I'm currently loading a view(ascx) into a div using jQuery load(). I want to
I'm currently using Prototype, but I'd like to rewrite this function to jQuery: function
I'm currently using jquery's ajax feature or whatever they call it. To load data
I'm currently trying to build a filter search function using JQuery and Ajax. The
Im using jquery to load in 2 external pages, one called search.php and the
I'm currently using jQuery and am looking for a way to slide an image

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.