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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:47:23+00:00 2026-06-03T22:47:23+00:00

I have a div on my home page which uses a jQuery plugin called

  • 0

I have a div on my home page which uses a jQuery plugin called hoverwords to create roll-over animations for some links inside the div which looks like this:

<div id="contentWrapper">    
    <div class="animations">
            <a href="#" id="animatedText1">Text1</a>
            <a href="#" id="animatedText2">Text2</a>
            <a href="#" id="animatedText3">Text3</a>
    </div>
</div>

It loads the plugin just fine on first load using the following script:

$(function(){
     $(window).load(function(){
         $(".animations a").hoverwords();
     });    
});

I am then using AJAX to asynchronously load in the content from my other pages if JavaScript is enabled. Some of the other pages use the same hoverwords plugin and I am having a difficult time re-loading the script as it is not called as an event which I could potentially bind using .on() or .live(). Here’s how I’m loading the new content using jQuery animation to hide the page then show the new page once loaded through AJAX:

$(function() {

$(".button").click(function() {

    var anchor = $("#contentWrapper");

    var pageHeight = $("#contentWrapper").height();

    var pageName = 'null';

    var extension = '.htm';

    if ($(this).attr('id')==='home') {
        pageName = 'index';
        extension = '.html';
    } else {
        pageName = $(this).attr('id');
    }

        $.ajax({
        type : 'get',
        url : pageName + extension,

        success : function() {
            var $newContent = $('<div id="contentWrapper" />').load(pageName + extension + ' #contentWrapper > *');
            $("#contentWrapper").replaceWith($newContent);

        };
    });

});
}); 

I’m new to jQuery and may be doing this entirely the wrong way, but I’m completely stumped at this point as to how to get the same script re-applied to the newly loaded AJAX 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-03T22:47:24+00:00Added an answer on June 3, 2026 at 10:47 pm

    jQuery load has a callback parameter that you can use to rebind your hoverwords functionality to the newly-added DOM elements. You’ll want to use the callback handler so that you don’t try to add the hoverwords to the DOM before your new content has been loaded:

     var $newContent = 
         $('<div id="contentWrapper" />')
             .load(pageName + extension + ' #contentWrapper > *', function() {
    
              // bind the hoverwords on the new content inserted in the DIV
              $("#contentWrapper").find(".animations a").hoverwords();
    
          });
    

    Also, I’m not 100% sure that load returns anything to $newContent. This should be processed by the actual callback handler and added to the DIV#contentWrapper once the content is downloaded. There are more examples of jQuery load in action on the jQuery site.

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

Sidebar

Related Questions

I have this jQuery plugin called Easy Slider which I'm implementing on this site
I have a div in which a page is loaded with the DojoX Layout
I had a home page which have a few tables that refresh itself every
I have an ASP.NET 4.0 home page which displays about 20 product listings. Each
I have various pages in html like this <body onload=init()> <div data-role=page id=home> <div
I have a web application which has a search facility. On the home page
I have an article 'tag' sidebar which is positioned correctly on the Home page,
I have a page which loads its inner content using jquery and a simple
I am creating one application with jquery.mobile-1.0a4.1 release. I have a page which is
I have a page which acts as an AJAX loader using jQuery. It fetches

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.