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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:11:30+00:00 2026-06-11T05:11:30+00:00

English isnt my native language so bear with me. Im trying to make it

  • 0

English isnt my native language so bear with me.

Im trying to make it so that when a user clicks any image on my site a gallery sort of div will become visible containing the image at its fullest size.

The way I’ve done now is;

    var image = $("body > image");


image.on('click', function(){
    var imageURL = $(this).attr('src');
    backgroundCurtain.css({"display": "block"});
    imageResized.attr("src", imageURL);
    var imageWidth = imageResized.width();
    pictureInner.css({"width" : imageWidth});
}); 

This isn’t working and to be honest I wasn’t expecting it to work. How do I call it so that every image element inside body. How do I “call” every image inside body?

  • 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-11T05:11:32+00:00Added an answer on June 11, 2026 at 5:11 am

    To reference all images using jquery, simply do

    var images = $("img");
    

    Usually you don’t want to have this to apply to all images, though (for example the imageResized shouldn’t be in this set). A good solution is to add a css class (for example class="zoomable") to the elements you want to be zoomable and use this selector :

    var images = $("img.zoomable");
    

    Have a look at this reference.

    Note that most of the time, we don’t use the same URL for the bigger image as this would mean to have big images loaded for thumbnails. My practice is to have a naming pattern like “someFile.jpg” and “someFile-big.jpg” and to do this kind of thing :

    $("img.zoomable").on('click', function(){
        var imageURL = $(this).attr('src');
        backgroundCurtain.css({"display": "block"});
        imageResized.onload = function(){
            var imageWidth = imageResized.width();
            pictureInner.css({"width" : imageWidth});
        };
        imageResized.attr("src", imageURL.split('.')[0]+'-big.jpg');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all, sorry for my bad english, isnt my native language. Im using
English is not my native language and I can't understand how to write the
I am new to the python language, so please bear with me. Also English
This is kinda hard to explain since english isnt my main language so i
English isn't my first language so i can't come up with a good name.
English, of course, is a no-brainer for regex because that's what it was originally
First sorry for my english. I am currently trying to develop a JAVA webservice
When using english the following URL should apply: http://example.org/services/myservice/ When using another language, the
sorry for my English. I write bash-file, that uses variable: shared_var=/system/xbin My script-file: exec=./adb
I want to make a searching option for my site, and for fun I

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.