Jump to content

Is It a Case of Bubbling?


iwato

Recommended Posts

UNDERSTANDING THE PROBLEM:

Probably the best way to understand the problem that the following piece of code produces is to observe the problem in action.  Please do the following:

  1. Open to the Grammar Captive podcast_hostpage.php.
  2. Look for the following path in the navigation bar on your left:  Podcast Archives/Concept/Podcast Index ...
  3. Click on the words Podcast Index ...
  4. Run your mouse over the list stopping at various places within the list until the following effect is produced.  An unending back and forth opening and closing of the <li> elements of a particular <ul> element.  Caution:  only the first three <li> elements are active.

The RELEVANT CODE

$("#main").html(concept_var);
$("#main").find('.cat_list').children().hide();
$("#main").find('.cat_list').each(function(){
    $(this).hover(function(){
            $(this).children().show(400);
            $(this).find('li').mouseenter(function(){
                $(this).css('cursor','pointer');
                }).click(function(){
                    ...
                });				
            });
        },
        function(){
            $(this).children().hide(400);
        }
    );
});

QUESTION:  How does one insure that one list is closed before another is open, and that no two lists or sublists is open at the same time"

Roddy

Edited by iwato
Link to comment
Share on other sites

That's a design problem.  If you hover over the second bullet it's a fairly long list that pops up.  Then if you move to hover over the third one, so that the second one collapses and the third one expands, the third one is smaller than the second one so once it's expanded the mouse is no longer over it, now the mouse is over the fourth or fifth item or something.  So if you're just doing hover and mouseover stuff that's going to cause a problem when you move things around so that the mouse is now hovering over a different element.  Maybe use click events instead of hover events.

Link to comment
Share on other sites

Can you think of a different way?  I purposely used hover to make possible to see what is available at a glance. 

Roddy

Link to comment
Share on other sites

The main issue is the animation. If you eliminate the animation, you're eliminating the window of time in which the user can move the mouse over to a different element.

It's a design flaw to have content that changes the location of elements on mouseover and mouseout events because it makes it difficult for the user to reach elements they want to get to. Whenever anything causes elements to shift around, it's always better to use click events for it so that any rearrangement that occurs was intended by the user.

  • Thanks 1
Link to comment
Share on other sites

OK, guys!

I have made the switch.  I have eliminated the multiple and simultaneous animations and switched to click.  All that remains is getting the cursor to appear properly, but this should be much easier to achieve.

Many thanks!

Roddy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...