Thursday, 15 January 2015

jquery - can not create jsfiddle properly to overlap divs on hover -



jquery - can not create jsfiddle properly to overlap divs on hover -

i have not been able create jsfiddle actual question.

html

<div class="item1"> item1 </div> <div class="item2"> item2 </div>

css

item1 { position:absolute; width:100px; height:100px; background-color:red; top:5%; } .item2 { position:absolute; width:50px; height:50px; background-color:blue; top:8%; left:1%; display:none; }

i trying display item2 on item1 hover

http://jsfiddle.net/z9unk/23/

but on hover not display item2. should right??

please help?

you need $ @ start of jquery selectors.

change this:

(".item1").hover( function() { (".item2").css("display", "block"); } );

to this:

$(".item1").hover( function() { $(".item2").css("display", "block"); } );

live demo: http://jsfiddle.net/z9unk/25/

jquery html css jsfiddle

No comments:

Post a Comment