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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:10:15+00:00 2026-05-15T02:10:15+00:00

~ On my articles page ( http://www.adrtimes.squarespace.com/articles ) I have each entry start with

  • 0

~ On my articles page (http://www.adrtimes.squarespace.com/articles) I have each entry start with an image that changes on rollover. This is working fine.

However, on my homepage (http://www.adrtimes.squarespace.com), I am loading in the 2 most recent articles that are not categorized as video, and the 2 most recent articles that are tagged as video. I am using jQuery load() to pull in the content from the articles page. Everything works ok with that except the swapImage rollovers on the homepage. i tried including the swapImage function as callbacks but only one group or the other will rollover properly, not both groups of content. I’m not sure what the problem is!!

Here is the code:

<script type="text/javascript">
<!--

$(function(){ 

$.swapImage(".swapImage");

/* Homepage */
// load recent articles
$("#LoadRecentArticles").load("/articles/ .list-journal-entry-wrapper .journal-entry-wrapper:not(.category-video)", function(){ 
  //callback...
  $("#LoadRecentArticles .journal-entry-wrapper").wrapAll('<div class="list-journal-entry-wrapper" />');
  $("#LoadRecentArticles .journal-entry-wrapper:gt(1)").remove();
  // modify Read More tag
  $('.journal-read-more-tag a:contains(Click to read more ...)').each(function(){ 
      var str = $(this).html(); 
      $(this).html(str.replace('Click to read more ...','Continue reading—')); 
  });
  $.swapImage(".swapImage"); 
});

// load recent videos
$("#LoadRecentVideos").load("/articles/category/video .list-journal-entry-wrapper", function(){ 
  //callback...
  $("#LoadRecentVideos .journal-entry-wrapper:gt(1)").remove();
  $('<div class="VideoTag">—video</div>').insertBefore("#LoadRecentVideos .category-video .body img");
  // modify Read More tag
  $('.journal-read-more-tag a:contains(Click to read more ...)').each(function(){ 
      var str = $(this).html(); 
      $(this).html(str.replace('Click to read more ...','Continue reading—')); 
  });
  $.swapImage(".swapImage");
}); 


}); 
-->
</script>

And here is a sample of the html for the images in an article entry:

<a href="/articles/2010/5/6/article-title-goes-here.html"><img class="swapImage {src: '/storage/post-images/Sample2_color.jpg'}" src="/storage/post-images/Sample2_bw.jpg" /></a>
  • 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-05-15T02:10:15+00:00Added an answer on May 15, 2026 at 2:10 am

    My apologies if this isn’t what you want, but it is really pretty simple to do your own swap.

    I don’t know exactly what your selector should be, but this will grab the src of the image when you mouseenter, and change it from _bw.jpg to _color.jpg, and back when you mouseleave.

    HTML:

    <img class='imageToSwap' src="http://adrtimes.squarespace.com/storage/post-images/Sample2_bw.jpg">
    

    jQuery:

        $('.imageToSwap').hover(function() {
            var $th = $(this);
            var src = $(this).attr('src');
            var newSrc = src.replace(/_bw.jpg/, '_color.jpg');
            $th.attr('src', newSrc)
        },
        function() {
            var $th = $(this);
            var src = $(this).attr('src');
            var newSrc = src.replace(/_color.jpg/, '_bw.jpg');
            $th.attr('src', newSrc)
        });
    

    EDIT:

    version using live()

    Hopefully this will do it for you. jQuery’s live() function will manage events for elements dynamically added to the DOM after the page loads.

    Give it a try, and let me know how it turns out.

    $('.imageToSwap').live('mouseover mouseout', function(event) {
        var $th = $(this);
        var src = $(this).attr('src');
        if (event.type == 'mouseover') {
          var newSrc = src.replace(/_bw.jpg/, '_color.jpg');
          $th.attr('src', newSrc)
        } else {
          var newSrc = src.replace(/_color.jpg/, '_bw.jpg');
          $th.attr('src', newSrc)
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1
I wanted to implement Comet in PHP and came across this page: http://www.zeitoun.net/articles/comet_and_php/start The
I have a website with 3 pages, while each page has articles that are
I have downloaded the jquery scroll script (http://www.position-absolute.com/articles/better-html-anchor-a-jquery-script-to-slide-the-scrollbar/) which will scroll to your anchor
I found an old article http://www.artima.com/lejava/articles/beans_binding.html And a deserted project page http://java.net/projects/beansbinding Is it
I have followed a couple of tutorials (http://www.adobe.com/devnet/html5/articles/javascript-motion-detection.html, http://www.html5rocks.com/en/tutorials/canvas/notearsgame/ ) and spliced the two
The page in question is featured here: http://www.allwebcafe.com/news/news-article.php?id=78 For some reason, when a user
I've trying to use the API for CapsuleCRM... http://capsulecrm.com/help/page/api_gettingstarted I've been reading some articles
I have a page full of links that each AJAX in an article based
I am a new facebook application deverloper. I followed this tutorial: http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.html but I

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.