fix home page safari pic display

This commit is contained in:
Gitshaoxiang
2020-04-10 23:03:31 +08:00
parent c2423bcf06
commit 85fb3d48cd
3 changed files with 35 additions and 2 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -875,6 +875,7 @@ mark {
.easyloader-box p:last-child {
overflow-y: scroll;
height: 20%;
font-size: 10px;
}
.easyloader-mask {
@@ -909,6 +910,7 @@ mark {
justify-content: space-around;
bottom: 7%;
width: 100%;
padding: 0px 20px;
}
.easyloader-btn a {
+32 -1
View File
@@ -260,7 +260,29 @@
}
}
function use_png() {
pics = $("img");
var page_url = window.location.href;
for (var i= 0; i<pics.length; i++){
if((page_url.slice(-4) == "/en/")||(page_url.slice(-7)== "/zh_CN/")||(page_url.slice(-3)== "/#/")){
if (pics[i].src.indexOf(".webp") != -1) {
var path = pics[i].src.substr(0,pics[i].src.indexOf(".webp"));
pics[i].src = path+".jpg"
}
}else{
if (pics[i].src.indexOf(".webp") != -1) {
if (pics[i].src.indexOf("m5stack.oss") != -1) {
var path = pics[i].src.substr(0,pics[i].src.indexOf(".webp"));
pics[i].src = path+".jpg"
}else{
var path = pics[i].src.substr(pics[i].src.indexOf("/assets/"),);
path.replace(".webp",".jpg");
pics[i].src = "https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/product_png"+path;
}
}
}
}
}
function page_loading() {
var test = window.location.href;
if ((test.indexOf(/en/) == -1) && (test.indexOf(/zh_CN/) == -1)&& (test.indexOf(/ja/) == -1)) {
@@ -277,6 +299,14 @@
}
}
function isSupportWebp() {
if (document.createElement('canvas').toDataURL('image/webp', 0.5).indexOf('data:image/webp') === 0){
return true;
}
use_png();
}
// console.log(isSupportWebp());
function page_move(divId) {
var t = $("#" + divId).offset().top;
$('html, body').animate({
@@ -381,6 +411,7 @@
}
}
function anchor_search(purchase_link="none",quickstart_link="none"){
isSupportWebp();
var page_url = window.location.href;
if((page_url.slice(-4) == "/en/")||(page_url.slice(-7)== "/zh_CN/")||(page_url.slice(-3)== "/#/")){
$("#search_note").eq(0).after("<div class='anchor-box'></div>");