动态创建浮动元素

#smoothmenu1{
        width:200px;
        height:200px;
        background-color: #ff9900;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    #frameDiv{
        width: 210px;
        height: 40px;
        position: fixed;
        top: 15px;
        right: 20px;
        z-index: 9999;
        color:#cc0000;
        font-size: 20px;
        text-align: right;
        font-weight: bold;
    }
<div id='smoothmenu1'></div>
function fun(){
    setTimeout(function(){
         var frameDiv = document.createElement("div");
         frameDiv.id = 'frameDiv';
         var ssmm1 = $("#smoothmenu1");
         //frameDiv.innerHTML = "";
         ssmm1.append(frameDiv);
         $("#frameDiv").html('123')
    },500)

}
fun()

 

posted @ 2021-11-05 15:22  石头记1  阅读(34)  评论(0)    收藏  举报