hoverIntent with iframe, messes up with border and height. hover works

55 Views Asked by At

I've seen this already: jQuery hoverIntent not working, but hover does

However, I DO have two handlers for in and out, and hoverIntent still doesn't work. Hover does. I'm positive I have all the directories right as well.

var sidebar = $('#sidebar');

    sidebar.hoverIntent(function(){
        sidebar.attr('id','sidebar_active');
    }, function(){
        sidebar.attr('id','sidebar');
    });

The sidebar is an iframe:

<iframe id="sidebar" scrolling="no" src="sidebar/sidebar.php"></iframe>

IDs are here:

#sidebar{
    width:56px;
    border:0; 
    height:100%; 
}

#sidebar_active{
    width:150px;
    border:0; 
    height:100%; 
}

Any ideas?

1

There are 1 best solutions below

2
Asad Ali Kanwal On BEST ANSWER
$(function(){
var sidebar = $('#sidebar');

    sidebar.hoverIntent(function(){
        sidebar.attr('id','sidebar_active');
    }, function(){
        sidebar.attr('id','sidebar');
    });
})

Here is the working link http://jsfiddle.net/asadalikanwal/usL4a8xj/