聘我网

新概念招聘3.0

js弹出对话框求实现

vote up0vote downstar

当点击某个文字的时候,在其附近弹出一个对话框,上面有文字,当点击对话框时再消失,该如何实现?

 

1 个答复

vote up0vote downcheck
<script type="text/javascript">
$(function(){
    $('.showme').click(function() {
        $('.error-notification').remove();
        var $err = $('<div>').addClass('error-notification')
                             .html('<h2>Paolo is awesome</h2>(click on this box to close)')
                             .css('left', $(this).position().left);
        $(this).after($err);
        $err.fadeIn('fast');
    });
    $('.error-notification').live('click', function() {
        $(this).fadeOut('fast', function() { $(this).remove(); });
    });
});
</script>
<style type="text/css">
.error-notification {
    background-color:#FE7A15;
    color:white;
    cursor:pointer;
    display: none;
    padding:15px;
    padding-top: 0;
    position:absolute;
    z-index:1;
    font-size: 100%;
}

.error-notification h2 {
    font-family:Trebuchet MS,Helvetica,sans-serif;
    font-size:140%;
    font-weight:bold;
    margin-bottom:7px;
}
</style>

点击这里看示例

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.