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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:14:01+00:00 2026-05-30T04:14:01+00:00

Depending on a condition (screen resolution for example), I want the image src value

  • 0

Depending on a condition (screen resolution for example), I want the image src value to be changed for all images on a page. If possible, how do I achieve this with jQuery?

For example:

For resolutions above 1000(width), if my image src reads src=img/image1.jpg, how do I change this for a different resolution (say less than 1000 width) to src=’lower_img/image1.jpg’

(i.e. adding a prefix lower to image)

basically, I am maintaining two folders img and lower_img and images should be pulled from respective folders based on the resolution (image names are same in both folders)

note: I don’t need the screen resolution detection script, I’m only looking for the image src substitution part

Thanks in advance.

  • 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-30T04:14:03+00:00Added an answer on May 30, 2026 at 4:14 am

    This will prepend the “lower_” text to all images on the page. You would just need to add this into your browser size detection code.

    So, if browser has less than 1000 pixel width:

    $('img').attr('src', function(index, source) {
         return 'lower_' + source;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my .cs page i want to check some condition and depending on that
Depending on the result of a condition, I want to display a UIImageView in
I have a code that shows a different image depending where on the page
I was trying to return value true or false depending upon the condition by
i Want to import a given css or javascript file depending os some conditions,
Depending on where I use my Class, I want to be able to show
I am trying to call a class method dynamically depending on a condition. This
In my code, depending on a condition, a JTree node might or might not
I have a Java array: String[] myArray = {1, 2}; Depending on a condition
I have a REST endpoint that returns a BOOL value depending on whether or

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.