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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:14:06+00:00 2026-06-14T14:14:06+00:00

I have a function with a event listener that then prompts another function. Before

  • 0

I have a function with a event listener that then prompts another function. Before the event listener the function worked perfectly fine. What’s suppose to happen is text is suppose to get loaded into their respective divs, and then when they finish there’s suppose to be an animation function that happens. The animation function causes the text loading to be skipped for some reason.

Here is the JS BIN set up http://jsbin.com/umohoj/11/edit

and here it is on url for the .load (even though they don’t work with the eventlistner)

http://www.klossal.com/b_test.html

here is a working example of just the loads with no animations:

http://www.klossal.com/b_testa.html

here is a working example of the animations with the loads as one function, instead of the animations waiting for the loads to finish, which is what I’d like to have happen because the loads need to finish for some of the calculations in the animations to work correctly.

http://www.klossal.com/b_testb.html

here is the code with the event listener that for some reason prevents the loads from working:

$(".name").click(function() {
  var id = $(this).attr('id');

  $('#photo_850').empty();

  $("<img>", { src: id + ".jpg" }).prependTo("#photo_850");

  $("#name_850").load(id +"_name.txt");

  $("#credentials_850").load(id +"_credentials.txt");

  $("#bio_850_text").load(id +"_bio.txt", function() {
    $("#bio_850_img").css({
    marginTop: ($("#bio_850_text").innerHeight() /2) -   
    ($("#bio_850_img").height() / 2)
    });                                                                     
  });

  $("#edu_850_text").load(id +"_edu.txt", function() {
    $("#edu_850_img").css({
    marginTop: ($("#edu_850_text").innerHeight() /2) -   
    ($("#edu_850_img").height() / 2)
    });                                                                     
  });

  $("#contact_850_text").load(id +"_contact.txt", function() {
    $("#contact_850_img").css({
    marginTop: ($("#contact_850_text").innerHeight() /2) -   
    ($("#contact_850_img").height() / 2)
    });                                                                     
  });






}, function() {




  $("#container_1").animate({
     height: 87 + $("#box_2_850").height() + $("#box_3_850").height() +     
$("#box_4_850").height()
  }, 300);

  $("#container_1_txt").animate({
     "margin-top": $("#container_1_txt").innerHeight() * -1
  }, 300);

    $("#box_1_850").delay(160).animate({
     marginTop: 15
  }, 300);

    $("#box_2_850").delay(330).animate({
     marginTop: 0
  }, 450);  

    $("#box_3_850").delay(450).animate({
     marginTop: 0
  }, 450);  

    $("#box_4_850").delay(570).animate({
     marginTop: 0
  }, 450); 










                 });
  • 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-14T14:14:07+00:00Added an answer on June 14, 2026 at 2:14 pm

    After extensive research 😉 I have a solution! Haha

    $("#container_1").css({
      'height': $("#container_1_txt").innerHeight()
    });
    
    $("#box_1_850").css({
      'marginTop': $("#container_1_txt").innerHeight()
    });
    
    $("#box_2_850").css({
      'marginTop': $("#container_1").height()
    });
    
    $("#box_3_850").css({
      'marginTop': $("#container_1").height()
    });
    
    $("#box_4_850").css({
      'marginTop': $("#container_1").height()  
    });
    
    
    var x1, x2, x3; //Establish Loading Variables 
    
    $(".name").on('click' , function() { 
    
      x1=0; //Reset the Loading Variables
      x2=0;
      x3=0;
    
      var id = $(this).attr('id');
    
      $('#photo_850').empty();
    
      $("<img>", { src: 'http://www.klossal.com/' + id + ".jpg" }).prependTo("#photo_850"); 
    
      $("#name_850").load(id +"_name.txt");
    
      $("#credentials_850").load(id +"_credentials.txt");
    
    
    
      $("#bio_850_text").load(id +"_bio.txt", function() {
    
        $("#bio_850_img").css({
        'marginTop': ($("#bio_850_text").innerHeight() /2) -   
        ($("#bio_850_img").height() / 2)
        });
    
        console.log('Loaded'); //Testing Purposes Only
        x1=1; // Loaded
        animate(); // Attempt Animation
    
      });
    
      $("#edu_850_text").load(id +"_edu.txt", function() {
    
        $("#edu_850_img").css({
        'marginTop': ($("#edu_850_text").innerHeight() /2) -   
        ($("#edu_850_img").height() / 2)
        });
    
        console.log('Loaded'); //Testing Purposes Only
        x2=1; // Loaded
        animate(); // Attempt Animation
    
      });
    
      $("#contact_850_text").load(id +"_contact.txt", function() {
    
    
        $("#contact_850_img").css({
        'marginTop': ($("#contact_850_text").innerHeight() /2) -   
        ($("#contact_850_img").height() / 2)
        });
    
        console.log('Loaded'); //Testing Purposes Only
        x3=1; // Loaded
        animate(); // Attempt Animation
      });
    
    
    
    
    
    
    });
    
    
    
    
    function animate() {
    
      if((x1===1) && (x2===1) && (x3===1)){ //Animate if all thre divs are loaded
    
    
    
      $("#container_1").animate({
         'height': 87 + $("#box_2_850").outerHeight() + $("#box_3_850").outerHeight() + $("#box_4_850").outerHeight()
      }, 300);
    
      $("#container_1_txt").animate({
         'margin-top': $("#container_1_txt").innerHeight() * -1
      }, 300);
    
        $("#box_1_850").delay(160).animate({
         'marginTop': 15
      }, 300);
    
        $("#box_2_850").delay(330).animate({
         'marginTop': 0
      }, 450);  
    
        $("#box_3_850").delay(450).animate({
         'marginTop': 0
      }, 450);  
    
        $("#box_4_850").delay(570).animate({
         'marginTop': 0
      }, 450); 
    
     }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have more than one Event Listener that calls a specific function, and I
I have a JavaScript event listener function that waits for a user to click
I have an event/listener manager that has this function: var addListener = function(event, listener)
I have this event listener: input_1.addEventListener('input',function(){ updateFromInput(1); },false); It controls the location of a
Currently I have this listener event on my google maps: google.maps.event.addListener(map, 'dragend', function() {
In as3, I am adding event listener and then attaching the anonymous function to
I have written the following function which adds an event listener and registers the
So I have a movieclip in my flash that has an event listener that
I have this: function change( event, file ) { console.log( filename, file ); //It
I have a function like this in actionscript3 private function uploadFile(event:MouseEvent):void { var uploader:URLRequest

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.