|
@@ -163,7 +163,7 @@ function addStr(str){
|
|
|
* @param {*} txtdiv 字符串要展示的div
|
|
|
*/
|
|
|
function setFont(str,txtdiv){
|
|
|
- let count =parseInt(30/400*window.innerWidth)-4;
|
|
|
+ let count =parseInt(20/400*window.innerWidth)-4;
|
|
|
let strCount=str.length;
|
|
|
let rows=Math.ceil(strCount/count);
|
|
|
let endCount=strCount%count;
|
|
@@ -176,14 +176,14 @@ function setFont(str,txtdiv){
|
|
|
rowCounts.push(endCount)
|
|
|
innertxt+=str.substr(count*(rows-1),endCount==0?count:endCount);
|
|
|
txtdiv.innerHTML=innertxt;
|
|
|
-
|
|
|
let width=(window.innerWidth-txtdiv.clientWidth)/2;
|
|
|
- let fontsize=20/1920 *window.innerWidth;
|
|
|
+ let fontsize=14/1920 *window.innerWidth*(6*400/window.innerWidth);
|
|
|
let left=(width/window.innerWidth)*100+"%";
|
|
|
- let padding=fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px" ;
|
|
|
+ let padding=fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px "+fontsize/2+"px";
|
|
|
let styleStr="position: absolute;z-index: 100;bottom: 10%;background-color:rgba(157,96,34,0.5);padding:"+padding+";color:white;left:"+left+";font-size:"+fontsize+"px;";
|
|
|
//styleStr+="lineHeight:"+5*rows+"px;";
|
|
|
- styleStr+="height:"+20*rows+"px"
|
|
|
+ styleStr+=" line-height:23px;"
|
|
|
+ styleStr+="height:"+(25*rows)+"px"
|
|
|
txtdiv.setAttribute('style',styleStr);
|
|
|
}
|
|
|
// //字体自动大小适应
|