admin管理员组文章数量:1336331
When you click the icon on the page you will find a div pops up displaying some information. I just cannot figure it out how they did the effect using css/jQuery things. What is the mechanism of the effect?
When you click the icon on the page http://www.mansory./en/dealers you will find a div pops up displaying some information. I just cannot figure it out how they did the effect using css/jQuery things. What is the mechanism of the effect?
Share Improve this question asked Jan 7, 2013 at 2:32 josh kuglerjosh kugler 952 gold badges2 silver badges11 bronze badges 3-
They used mechanism in which they default make the popup ul
display:none
and when you click on any link using jquery it add any class sayhovering
and add css for that class isli.hovering li.innermost
– Arpit Srivastava Commented Jan 7, 2013 at 2:37 - 1 Fire a reveal modal. – The Alpha Commented Jan 7, 2013 at 2:42
- start by looking in browser console at the element css when it is shown and when hidden...will give you a lot of the clues right there. Can often see the live animation css changes also... at least in Firebug you can – charlietfl Commented Jan 7, 2013 at 2:50
2 Answers
Reset to default 3This mechanism is called animation. They simply show/hide the div and continuously change the position of the popup.
See more at http://api.jquery./animate/
I make a simple demo here
HTML:
<div class='container'>
<button id="btnShow">Show</button>
<div class='menu' style='display: none'>
<button id="btnHide">Close</button><br/>
Ernst-Heinkel-Strasse 7,<br/>
DE-71394 Kernen i.R. Germany<br/>
Contact <br/>
Telefon: 07151 / 994 64 -0<br/>
Fax: 07151 / 994 64 -22<br/>
www.herceg. <br/>
email: [email protected] <br/>
</div>
</div>
JS:
$(document).ready(function(){
$('#btnShow').click(function(){
$('.menu').show().css("top", "400px").animate({top: 50}, 200);
});
$('#btnHide').click(function(){
$('.menu').hide();
});
});
CSS:
.container {
with: 400px;
height: 300px;
border: 1px solid black;
}
.menu {
position: absolute;
border: 1px solid black;
background: #fff;
left: 180px
}
They simply show/hide a div and position it absolutely over top the page. Take a look at the div with the id infobox
and you'll see all the css needed to do this. Inside of infobox
is all the text for the different countries already, each one surrounded by a div with the property display:none
. Depending on what country you click on they will change the display property to block
on the corresponding div and display:none
on all the rest.
本文标签: javascriptHow to implement this cool popup div effect using jQueryStack Overflow
版权声明:本文标题:javascript - How to implement this cool popup div effect using jQuery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742405311a2468697.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论