2013-04-24 80 views
0

我遵循here的指示,在桌面上的效果很好,但在移動瀏覽器中,地圖只是空白(在Android,iOS上進行檢查)。似乎該腳本沒有在移動設備上運行(瀏覽器中允許使用javascript),因爲結果頁面沒有在div#map_leads中執行的代碼。Google地圖在手機瀏覽器中無法使用

This就是這樣。

任何人都可以幫助解決它嗎?

使一個更清晰page其中只包含地圖,一切工作正常...將嘗試在網站上找到錯誤的代碼。

我發現,對於地圖的原因不能正常使用的是下面的JavaScript:

(function() { 

function t(e) { 
this.path=e; 
var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1]; 
this.at_2x_path=n+"@2x."+r 
} 

function n(e) { 
this.el=e,this.path=new t(this.el.getAttribute("src")); 
var n=this; 
this.path.check_2x_variant(function(e){e&&n.swap()}) 
} 

var e=typeof exports=="undefined"?window:exports; 

e.RetinaImagePath=t, 
t.confirmed_paths=[], 
t.prototype.is_external=function(){ 
return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain) 
}, 
t.prototype.check_2x_variant=function(e){ 
var n, 
r=this; 

if(this.is_external())return e(!1); 

if(this.at_2x_path in t.confirmed_paths)return e(!0); 

n=new XMLHttpRequest, 
n.open("HEAD",this.at_2x_path), 
n.onreadystatechange=function(){ 
return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path), 
e(!0)):e(!1)}, 
n.send() 
}, 

e.RetinaImage=n, 
n.prototype.swap=function(e){ 
function n(){ 
t.el.complete?(
t.el.setAttribute("width",t.el.offsetWidth), 
t.el.setAttribute("height",t.el.offsetHeight), 
t.el.setAttribute("src",e) 
):setTimeout(n,5)} 
typeof e=="undefined"&&(e=this.path.at_2x_path); 
var t=this; 
n()}, 

e.devicePixelRatio>1&&(window.onload=function(){ 
var e=document.getElementsByTagName("img"),t=[],r,i; 
for(r=0;r<e.length;r++)i=e[r],t.push(new n(i))})})(); 

我已經打破了它成自己行作爲起源於它是寫在一行。將嘗試修復它 - 認爲img元素有問題。

回答

0

將已添加的貼圖函數添加到發佈的腳本的末尾,並且正常工作。對不起浪費你的時間!