解决html页面初始化jquery-ui dialog闪一下消失

为dialog 添加class="dialog-init"

设置css样式

.dialog-init {
display: none;
}

在公共的js中加
$(".dialog-init").css("display","block");
css文件会先加载让隐藏掉dialog

$("#avatarDialog").dialog();方法在后面执行的时候就不会出现一闪的问题了

 
<div id="avatarDialog" title="更改头像" class="dialog-init">
    <div class="avatar-container">
        <div class="imageBox">
            <div class="thumbBox"></div>
            <div class="spinner" style="display: none"></div>
        </div>
        <div class="action">
            <div class="new-contentarea tc">
                <a href="javascript:void(0)" class="upload-img">
                    <label for="upload-file">请先选择图片...</label>
                </a>
                <input type="file" class="" name="upload-file" id="upload-file"/>
            </div>
            <input type="button" id="btnCrop" class="Btnsty_peyton" value="预览">
            <input type="button" id="btnZoomIn" class="Btnsty_peyton" value="+">
            <input type="button" id="btnZoomOut" class="Btnsty_peyton" value="-">
        </div>
        <div class="cropped"></div>
    </div>
</div>

 

posted @ 2017-05-27 16:10  sunniejs  阅读(2080)  评论(0编辑  收藏  举报