如何使内容在div底部
程序员文章站
2022-05-01 20:12:13
...
如何使内容在div底部
如何插入一段漂亮的代码片
主要的就是这个段代码introduce.scrollTop = introduce.scrollHeight
.
function switchs(lable){
var lable1 = document.getElementById('lable1');
var lable2 = document.getElementById('lable2');
var qrCode = document.getElementById('qrCode');
var introduce = document.getElementById('introduce')
let qrCodeShow =''
let detailsShow = ''
if(lable=='lable1'){
lable1.className='lable1'
lable2.className='lable2'
//底部样式更改
qrCodeShow = "<img src='./qrcode.png'/>"
qrCodeShow +="<div class='qrCodeText'>"
qrCodeShow +="<p>观看更多直播</p>"
qrCodeShow +="<p>请长按右侧二维码</p>"
qrCodeShow +="<p>识别并关注公众号</p>"
qrCodeShow +="</div>"
qrCode.innerHTML = qrCodeShow
detailsShow = "<p class='introduceLine'><span>讲题:</span>"+details.title+"</p>"
detailsShow += "<p class='introduceLine'><span>时间:</span>"+details.time+"</p>"
detailsShow += "<p class='introduceLine'><span>讲者:</span>"+details.doctor+"</p>"
detailsShow += "<p class='introduceLine'><span>医院:</span>"+details.hosp+"</p>"
detailsShow += "<p class='introduceLine'><span>介绍:</span>"+details.presentation+"</p>"
introduce.innerHTML =detailsShow
}else{
lable2.className='lable1'
lable1.className='lable2'
//
for(let i of comment){
detailsShow +="<div class='photo'>"
detailsShow +=" <img src='"+ i.photo+"'/>"
detailsShow +="<div class='test'>"
detailsShow +=" <p class='photoName'>"+ i.name+"</p>"
detailsShow +=" <p class='photoText'>"+ i.text+"</p>"
detailsShow +=" </div></div>"
}
introduce.innerHTML = detailsShow
introduce.scrollTop = introduce.scrollHeight
//底部样式更改
qrCodeShow =" <div class='speak'>"
qrCodeShow +="<input id='speak' placeholder='请遵守法律法规,文明发言' />"
qrCodeShow +="<div class='bnt' onclick='submit()'>发 表</div>"
qrCodeShow +="</div>"
qrCode.innerHTML = qrCodeShow
}
}
上一篇: div中文字自动换行
下一篇: css-- 背景渐变