if (window.location.href.indexOf("iphoneX")) {
var body = document.getElementsByTagName("body")[0];
var div = document.createElement("div")
div.setAttribute("style", "position:fixed;height:38px;bottom:-38px;width:100%;background:#fff;z-index:+1")
body.appendChild(div)
}
(function($) {
$.getUrlParam = function(name) {var reg = newRegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) returnunescape(r[2]); returnnull;
}
})(jQuery);
if ($.getUrlParam("iphoneX") == "true") {
$("body").append("<div style='position:fixed;height:38px;bottom:-38px;width:100%;background:#26272B;z-index:+1'></div>")
}
px=>rem像素单位转换
(function(doc, win){
var docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function (){
var clientWidth = docEl.clientWidth;
if (!clientWidth) return;
if (clientWidth >= 840){
docEl.style.fontSize = '150px';
} else if (clientWidth >= 640){
docEl.style.fontSize = '100px';
} else {
docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
}
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
vue router跳转:
<router-linktag="li" v-for="(item,index) in channelList" :key="item.uuid" :to="{name:'video-list',params:{curItem:item}}"></router-link>