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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:36:45+00:00 2026-06-12T08:36:45+00:00

I am making a modal that displays images for the client to viewer in

  • 0

I am making a modal that displays images for the client to viewer in larger form. and slides left and then slides the new image in from the left on click. When I click on the thumbnail on the page it is displays in the modal perfectly. But when I click on the first modal displaying image it returns null and the left settings is off. but when I click on the new image all is well and works perfectly from there on out. Why does it return null and how do I stop it.

CODE

  $( '#modal img').live('click',function(e){
    var index = $(this).attr('img_index');
    var img_og = $( '#viewer ul li img[img_index="' + index + '"] ');
    var imgOgWidth= img_og.width();
    index++;
    if(index > $( '#viewer ul li img').length ) {index = 0;}
    var left = ($( window ).width() - imgOgWidth  )/ 2;
    var src = img_og.attr('src');
    console.log($( window ).width() + " - " + img_og.width() + " = " + left);
    $(this).animate({"left":'-2000px'},300,function(){
        $(this).attr({'src':src,'img_index':index}).css({'width':imgOgWidth,"left":'2000px'}).animate({'left':left},300);
    });
});

CONSOLE.LOG

1288 - null = 644
1288 - 470 = 409
1288 - 900 = 194
1288 - 900 = 194
1288 - 900 = 194

HTML

<div id="modal" class="none">
<img src="" img_index="" />
</div>
  • 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-12T08:36:46+00:00Added an answer on June 12, 2026 at 8:36 am

    I’ve solved the problem, I was trying to access the “new” picture before incrementing the index. Thank you for your help.

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

Sidebar

Related Questions

This behavior is making me wonder about my sanity.. I have a form that
I am new with python and I am making a system that deals with
Here's my scenario. I call jqModal using its ajax functionality that displays a form
I am trying to show a modal pop up by making a getjson call
I'm making a site in two language ,I want to give a jquery Modal
So, I'm busy making a model viewer, I'm trying to get my dialog properly
In my C# application I have an option dialog that can be opened from
I'm trying to figure out how to pull data from multiple tables and making
I am an application development intern. I'm making an application using ASP.NET MVC3 that
New developer here. I'm making my first iPhone app. The app will display 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.