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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:45:53+00:00 2026-05-23T03:45:53+00:00

I have a link which contains several images. Upon hovering an interval is set

  • 0

I have a link which contains several images. Upon hovering an interval is set and css class is added, and iterated over the images. Upon mouse out the interval is cleared. Code below:

jQuery('#flicker').hover(
    function() {
       flicker = setInterval(function() {
           if (jQuery('#flicker img.active').next('img').length > 0) {
               jQuery('#flicker img.active').removeClass('active').next('img').addClass('active');
           } else {
               jQuery('#flicker img').removeClass('active');
               jQuery('#flicker img:first-child').addClass('active');
           } 
       }, 200);
     }, 
     function() {
       clearInterval(flicker);
     }
 ); 

For some reason on Internet Explorer 6,7,8 the link href changes on hover, to a string of numbers.

For a test case see here. Any help greatly appreciated, I’ve not seen this bug before!

Thanks.

( Also let me know if you can’t replicate, I’m testing on a Mac using Parallels. )

  • 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-23T03:45:53+00:00Added an answer on May 23, 2026 at 3:45 am

    It’s because you called the variable in which you store the interval timer flicker, which is also the id of your element, and you haven’t declared the variable and so you fall prey to the Horror of Implicit Globals. On IE (and some other browsers) id values end up being properties on the window object (the value being the Element), so you’re ending up assigning a number to the element, which on IE sets its “default” property, which is href.

    Just create a private context and declare your flicker variable:

    (function() {
        var flicker = 0;
    
        jQuery('#flicker').hover(
            function() {
               flicker = setInterval(function() {
                   if (jQuery('#flicker img.active').next('img').length > 0) {
                       jQuery('#flicker img.active').removeClass('active').next('img').addClass('active');
                       } else {
                       jQuery('#flicker img').removeClass('active');
                       jQuery('#flicker img:first-child').addClass('active');
                   } 
               }, 200);
             }, 
             function() {
               clearInterval(flicker);
             }
         ); 
    })();
    

    Off-topic: Some other changes I’d recommend:

    • Every time you call the jQuery function, a fair bit of work has to be done, so calling it repeatedly for the same selector when the document hasn’t changed is fairly inefficient. It’s one of those patterns that should raise a red flag in your mind when you see it. Recommend updating the hover code to store and reuse the result. (Mind you, it runs just fine on IE7 which isn’t exactly a fast browser, so…)
    • Recommend clearing the flicker variable when you clear the timer. 0 is a good value, because 0 is not a valid timer handle. (That’s why I used it as the initial value above.) Just in case something weird happens with the browser calling your functions.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link which once hovered over a box below slides down, once
I have a client who is wanting to create a link which contains product
I have a page which contains several tables, and I would like to format
I have link(127.0.0.1:8000/read) which contains json data.how to read a json data from link
I have a C# class library that contains several resources files organized in folders.
I have added an CSS file this way: <link rel=stylesheet href=style.css type=text/css media=screen, print>
As the title says - Here I have a link which contains img tag:
i have a default.aspx page which contains a iframe, whose source is set to
I have a link which animates some div 's height when its hovered, but
I have a link which return form with different ID's, and i need to

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.