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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:46:18+00:00 2026-06-06T23:46:18+00:00

Link to problem : Using .scrollTop() method inside a jQuery Dialog is not working

  • 0

Link to problem:

Using .scrollTop() method inside a jQuery Dialog is not working for me, the HTML markup is this:

<div id="toogleMAmaximized" style="background:#000000">
     <div id="missionsMinimized" style="display:none;margin-top:10px;margin-bottom: 10px;cursor:pointer"><img src="images/missionsMinimized.png" alt="missions"/></div>
     <div id="achivmentsMinimized" style="display:none;margin-top:5px;cursor:pointer">        <img src="images/achivmentsMinimized.png" /></div>
     <div id="missions" class="unselected MAmaximized"></div>
     <div id="achivments" class="unselected MAmaximized"></div>
     <div id="dataMA" style="position:absolute;top:10px;right:10px;display:none;width:850px;height:500px;background-image: url('images/background-home.png') ; overflow-y:scroll"></div>
</div>

I use a JavaScript function to populate the dataMA div.

        function populateMissionsData(){    
             $('#missions').empty();
             $('#dataMA').append('<h1 style="color:white">Current Missions:</h1>');
             for (var $key in missionData['current']){
                 $('#dataMA').append(missionData['current'][$key]);
             }
             $('#dataMA').append('<h1 style="color:white">Not started missions:</h1>');
             for (var $key in missionData['other']){
                 $('#dataMA').append(missionData['other'][$key]);
             }
             $('#dataMA').append('<h1 style="color:white">Ccompleted Missions:</h1>');
             for (var $key in missionData['completed']){
                 $('#dataMA').append(missionData['completed'][$key]);
             }
        }

This works great as i get my dataMA populated without issue. Now i have a button that expands the content of divs inside dataMA that uses livequery plugin, and here is the scroll problem:

        $(".plus").livequery('click',(function(){
              key = $(this).attr('key').toString();           
              $('#data'+ key).slideToggle('fast');

              //this is the problem, it does not scroll the dialog.
              $('#dataMA').scrollTop($('#data'+ key).offset().top);
              //Update - this does not work either
              $('#dataMA').scrollTop($('#dataMA')[0].scrollHeight);                        
              //Update 100 - This is not working either
              $('#dataMA').scrollTop($('#data'+ key).offset().top - $('#dataMA').offset().top + $('#dataMA').scrollTop());
              $(this).toggleClass('less')
              if($(this).hasClass('less')){
                   $(this).attr('src','images/less.png');
              }else{
                   $(this).attr('src','images/plus.png');
              }
          }));

When i trigger the plus button it doesn’t do the scroll, however when i click on the plus button again it acts as it was scrolled down and scroll up.

I have changed the dataMA selector with toogleMAmaximized , it scrolled but not as expected (it moved up the content inside of it)

Update 1
In case you are interested, my environment:
jQuery v1.7.1
jQuery UI 1.8.16
liveQuery 1.1.1

Update 2
I updated my environment to most recent versions of jQuery (1.7.2) and jQuery UI (1.8.21), keep having the same problem.

Update 3
Ok, i got a fiddle file for you guys to see the problem. I can’t get it right on my small screen hope you guys get it better. The first thing is to click on the image to the right, and then click on the first square. To see the scrolling problem click on any of the non loading icons on the titles (they have the plus class). The dataMA variable is a replacement of my query to the database which returns in result the string i putted there. I use livequery as had many problems using .on() on tags added using a .post() request.

jsfiddle

Update 4
Can anyone with a higher resolution than 1300×768 tell me if they get the jsfiddle file correctly? I havent been able to solve this issue.

Update 5

I’m able to scroll several elements but when the element it’s outside the conteined div it is not scrolled to, however as mention above when i hit the button again it try to scroll up.

Update 6

I updated the jsfiddle for better understanding, the procedure is the same: click on the image -> dialog pops up -> click on missions -> scroll down to the last one (a thick wall) -> click on the missing image to the right (i dont know why it does not display the alt content) doing that will display a hidding content, clicking on it again will hide it. However the automatic scroll is not done.

  • 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-06T23:46:20+00:00Added an answer on June 6, 2026 at 11:46 pm

    I finally understood where my problem was. I was trying to do the scroll before the slideToggle() effect was finished! all i need to do was to call the scrolling like this:

    $('#data'+ key).slideToggle('fast',function(){
        $('#dataMA').scrollTop($('#data'+ key).offset().top - $('#dataMA').offset().top + $('#dataMA').scrollTop());
    });
    

    Here is the solution

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

Sidebar

Related Questions

I am having a problem using $html->link helper in my view. Consider this snippet...
i have a problem using the Catch Clipboard Events code found on this link
It's easy to reproduce this problem using a simple html fragment (save as test.html):
I have a problem with using jQuery Dialog and Ajax submit in JSF. I
I tried solving my problem using this link update - I figured out that
A] Summary of the problem: Using jquery datatable ( http://www.datatables.net/ ) on the html
i tried to do a simple ksoap2 tutorial. This is the link My Problem
Link: http://www.fraynepainting.com/services The problem is that div#dditem_2 (the div with the Take a look...
I read many posts about this problem like [this link][1] and one solution is
I've search for some solution to my problem and I found this link .

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.