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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:24:00+00:00 2026-06-05T12:24:00+00:00

I used to have something like this: $(function() { $(.PortfolioFade img) .mouseover(function() { popup(‘PORTFOLIO’);

  • 0

I used to have something like this:

$(function() {
$(".PortfolioFade img")
    .mouseover(function() { 
                    popup('PORTFOLIO');
                    var src = $(this).attr("src").replace("images/paperclip.png", "images/paperclip-black.png");
        $(this).attr("src", src);
    })
    .mouseout(function() {
                    ;
    });
    });

And when I tried to turn this into a function and call it, it didn’t work at all. The image was not replaced.

The following is the function and following call that did not work, and I am at a loss as to why it didn’t work.

 $(document).ready(function() {
   // put all your jQuery goodness in here.
   $('body').hide().fadeIn(1000);

   //Changing Fonts
   function changeFont(element, fontFamily, fontSize)
{
    $(element).css("font-family", fontFamily);
    $(element).css("font-size", fontSize);
}
    function ImageRollover(image_element, popup_name, original, replacement)
{
    $(element)
        .mouseover(function(){
            popup(popup_name);
            var src = $(this).attr("src").replace(original,replacement);
            $(this).attr("src",src);

        })
        .mouseout(function(){
            ;
        });
}

$(function) {
   ImageRollover(".Portfolio img",'PORTFOLIO',"images/paperclip.png","images/paperclip-black.png");
});


 });
  • 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-05T12:24:03+00:00Added an answer on June 5, 2026 at 12:24 pm

    EDIT: Sorry, what I should’ve seen in the first place was that your ImageRollover() function declares a parameter image_element but then within the function you use element. So within the function change:

    $(element)
        .mouseover(function(){
    

    To:

    $(image_element)
        .mouseover(function(){
    

    (And forget about what I said before.)

    What your original version had but the new version doesn’t is a document ready handler. Try putting the call to your ImageRollover function in a document ready as follows:

    $(function() {
       ImageRollover(".Portfolio img",'PORTFOLIO',"images/paperclip.png","images/paperclip-black.png");
    });
    

    You can’t attach event handlers to elements that have not yet been parsed – the document ready handler is not called until the whole document has been parsed so at that point you can attach event handlers. Alternatively you can put your script somewhere after the elements it operates on, e.g., at the end of the body.

    I’d be inclined to move the ImageRollover function declaration into the document ready too, just to keep it out of the global namespace (assuming you only call it from within the document ready), though this isn’t necessary to make it work.

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

Sidebar

Related Questions

I have JS code something like shown below: function ValidateBid(source, args) { var txtValue
I have done something like this. <html> <head> <script type=text/javascript> <!-- function toggleTB(what){ if(what.checked){document.theForm.theTB.disabled=1}
In our code we used to have something like this: *(controller->bigstruct) = ( struct
I'm used to Java so when i try to so something like this: function
I used to have my permalinks to standard format, something like http://example.com/?page_id=2 . Now
This is the code i have. The NSDictionary did used to be something, but
So I have a function that looks like this: @SuppressWarnings(unchecked) public static <E> Set<E>
Basically, I have something like this: $.ajax({ type: GET, url: my_url, cache: true, success:
If I have something like this from the server side, from a fetch: array(1)
I have html that looks something like this: <div> <table> <tr onclick=show();> <td class=cell>Click

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.