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;
}
Set everything up as you would if you want to position: absolute inside a position: relative container, and then create a new fixed position div inside the div with position: absolute , but do not set its top and left properties. It will then be fixed wherever you want it, relative to the container.
A pinned-down menu The interesting rule here is the ' position: fixed ', that makes the DIV stay fixed on the screen. The ' top: 50% ' and ' right: 0 ' determine where the DIV is displayed, in this case: 50% down from the top of the window, and a constant 0px from the right.
A sticky element toggles between relative and fixed , depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).
The position() method returns the position (relative to its parent element) of the first matched element. This method returns an object with 2 properties; the top and left positions in pixels.
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.
Make the position as relative for the div which have clickable items.
position: relative;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With