DoYou EvenLift
DoYou EvenLift

Reputation: 319

jquery click not working with css 'position :fixed' property

When i am removing this property it is working fine, why is that so?

Here is the jquery function:

 $(document).ready(function(){
 $('#flogo').click(function(){

   window.alert("clicked");

})
});

Here is Html code:

<div id="fblike" class="fixedlogo"><img src="images/likelogo.png" id="flogo" />    </div>

Here is css:

 .fixedlogo
{
position: fixed; //If i remove this line then jquery is working.
height:50px;
margin-top: -20px;
}

Upvotes: 7

Views: 6743

Answers (2)

Nalan Madheswaran
Nalan Madheswaran

Reputation: 10572

Make the position as relative for the div which have clickable items.

position: relative;

Upvotes: 1

Brandon Durham
Brandon Durham

Reputation: 7727

This is likely an issue with z-index and not jQuery. jQuery wouldn't care what the position is set to. I suspect there is another element overlapping this one and blocking the click event.

Upvotes: 8

Related Questions