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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:50:23+00:00 2026-06-09T01:50:23+00:00

I am fairly new to jQuery/JavaScript so I am having a few problems, hopefully

  • 0

I am fairly new to jQuery/JavaScript so I am having a few problems, hopefully you can point me on the right track.

On my project I have a row of images, showing previews of images. Kind of a image gallery.

I want to be able to click onto the smaller images and then get simple Modal to display the full size image, dynamically resizing and animating.

Can I do this with Ajax, to refresh simple modal? I am still learning how to use Ajax with jQuery and there seems many ways to do it.

Here is what I have:

jQuery:

$('.col1').find('img.overlay').click(function() {

                $('#imgpreview').modal({overlayClose:true});

                var img = $(this).parent().find('img.shared').attr('src');
                var imgW = $(this).parent().find('img.shared').attr('width');
                var imgH = $(this).parent().find('img.shared').attr('height');

                $('#imgpreview').css('width', imgW);
                $('#imgpreview').css('height', imgH);                   
                $('#imgpreview').find('img').attr('src', img);

            });

    });

HTML:

            <div id="imgpreview"><img src=""></div>
                        <div class="col1 bg"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" height="104" src="img/uploaded/img1.jpg"></div>
                        <div class="col1 bg"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" height="104" src="img/uploaded/img2.jpg"></div>
                        <div class="col1 bg"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" height="104" src="img/uploaded/img3.jpg"></div>
                        <div class="col1 bg"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" height="104" src="img/uploaded/img4.png"></div>
                        <div class="col1 bg"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" height="104" src="img/uploaded/img5.jpg"></div>
                        <div class="col1 bg nmr"><img class="overlay" src="img/overlay.gif" width="104" height="104"><img class="shared" width="104" src="img/uploaded/img6.jpg"></div>

I can display the image inside the simple modal but the image does not sit inside the dimensions of the image so I can give it a border and styling, also means it does not sit in the middle.

Another option is to create a simple modal dialogue box for each image and echo out the jQuery with PHP since the images will be in the database. But would there be a better way?

  • 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-09T01:50:24+00:00Added an answer on June 9, 2026 at 1:50 am

    I don’t have a clue about that modal plugin. It’s been my experience that jQuery plugins are hardly worth the trouble of figuring out. That being said, you could try this….

    <head>
        $(document).ready( function() {
            $('.overlay).click( function() {
                $('#bigPic).append('<img id="myPic" src="my dynamic source.gif"/>');
            });//end click
        });//end ready
    </head>
    
    <body>
        <div id="previews">
    
            //Your posted html here
        </div>
        <div id="bigPic">
    
        </div>
    </body>
    

    Then the CSS would have something like :
    img #myPic{
    height: 100%;
    width: 100%;
    }

    It looks like you are a little confused by what this is in your question. In your case it is $(“img.overlay”) You can avoid all that nonsense by just adjusting the

    <div id="bigPic">
    

    to suit your needs.

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

Sidebar

Related Questions

I am fairly new to jQuery and JavaScript in general. I have a form,
I am fairly new to Jquery and javascript and have jumped in head first
I'm fairly new to jQuery and I'm having trouble with an animation that I'd
I'm fairly new to JQuery and for some reason I can't get the currently
I'm fairly new to JQuery and Javascript in general. I don't think I'm trying
I'm fairly new to facebook development, but have experience with PHP and JavaScript. I've
Fairly new to Jquery here.... but one thing I have been told and being
I'm fairly new to JavaScript/jQuery/AJAX, so I suspect the issue is some typo I'm
I'm fairly new to Javascript/JQuery. I'm trying to write an app that takes text
I'm fairly new to jQuery and JavaScript, and I've been trying to implement a

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.