I'm not exactly getting what you are trying to do.
but you can unbind the mouseenter if you only want to use it once.
- $('#cap').bind('mouseenter',function(){
- $('#cap').unbind('mouseenter');
- $('#capB').show(2,function(){
- $('#capB').hide();
- });
- });
But a show with 2, wil only show for 2 milliseconds (2/1000 seconds)
.blur() only removes the focus of the ellement. When you enter #cap #capB will be shown above it, if I understand you correctly. So when #capB hides again you will reenter #cap with your mouse and thus the function is triggerd again after that the blur is triggerd but then it's already to late.
If you want that the function is triggerd every time you enter #cap then you schould do something like this:
- $('#cap').bind('mouseenter',function(){
- if( ! $(this).is('.showCapB') ); // if #cap does not have the class of showCapB execute code else do nothing
- {
- $(this).addClass('showCapB'); // adds the class showCapB to #cap
- $('#capB').show(2,function(){
- $('#capB').hide(function(){
- $(#cap).removeClass('showCapB'); // removes the class showCapB from #cap
- });
- });
- }
- });