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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:26:27+00:00 2026-06-18T14:26:27+00:00

First question using stackoverflow! yay! I have a site I’m developing. It uses images

  • 0

First question using stackoverflow! yay!

I have a site I’m developing. It uses images as the menu options, and on hover, I’ve changed the img src in jquery

When you click the menu you want to go to, i want the image on hover to stay there.
I did this:
$("#one").click(function(){
$(this).attr('src', 'images/hover1.jpg');
$(this).unbind('mouseleave mousehover');

So this is successful but the upon another menu click, i cant get the hover image to go away, and then it doesnt hover anymore (cause i unbinded it) – but binding it upon another menu click wasnt working.

Any suggestions?

  • 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-18T14:26:29+00:00Added an answer on June 18, 2026 at 2:26 pm

    First of all. I think its recommend to create a CSS solution here.

    I checked out your javascript file and did some modifications in my browser. Finally I build you a possible working solution.

    $(document).ready(function() {
    
       var hoverfuncIn = function(){ $(this).attr('src', $(this).attr('src').replace(/(\D)(\.jpg)$/g,'$12$2')); };
       var hoverfuncOut = function(){ $(this).attr('src', $(this).attr('src').replace(/2(\.jpg)$/g,'$1')); };
       var clickToggle = function(e){
        $('.selected').hover(hoverfuncIn,hoverfuncOut).removeClass('selected').mouseout();
            $(e.currentTarget).addClass('selected').unbind('mouseleave mousehover');
    }
    
       $('nav img').hover(hoverfuncIn,hoverfuncOut);
    
       $("#one").click(function(e){
          clickToggle(e);
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a question about using GalleryView. At first, i set five default images
This is my first time using stackoverflow for a question, I have read a
My first question on codeigniter. I have integrated paypal in codeigniter using paypal library.
First question on Stackoverflow. After using JOIN to map a property I try to
This is my first question on Stackoverflow. I'm wanting to make an A.I. using
this is my first question in stackoverflow! im trying to reverse a string using
This is my first time using StackOverflow myself. I have found many answers to
this is my first question here in stackoverflow. I have two processes, a root
This is my first time using stackoverflow for a question that I need to
Well, well, this is my very first question in StackOverflow! I've been using this

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.