我已经完成了一个带有UI数据选择器的页面以显示事件,并且我试图将其放在Facebook页面标签中。除了IE,其他所有浏览器都可以正常运行。
初学者可能是愚蠢的猜测,但我认为问题出在DOCTYPE。问题是,当它只是一个页面时,IE会正确加载它。就在我将它放入facebook iframe jquery时,即使声明了doctype也不加载。我已经尝试了很多东西,但是我不知道发生了什么。有人可以帮我吗?
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<style>
.popup{
display:none;
}
</style>
</head>
<body>
<div class="centralizar">
<div id="calendario"></div>
<div id="popup1" class="popup">
<h3><strong>Teste1</strong></h3>
</div>
<div id="popup2" class="popup">
<h3><strong>Teste2</strong></h3>
</div>
<div id="popup3" class="popup">
<h3><strong>Teste3</strong></h3>
</div>
<div id="popup4" class="popup">
<h3><strong>Teste4</strong></h3>
</div>
<div id="popup5" class="popup">
<h3><strong>Teste5</strong></h3>
</div>
<div id="popup6" class="popup">
<h3><strong>Teste6</strong></h3>
</div>
</div>
</body>
</html>
这是jQuery:
$(function(){
var specialDays = {
'2013': {
'5': {
'27': {
content: "Teste",
className: "eventos",
popupID: "popup1"
}
},
'6': {
'10': {
content: "Teste",
className: "eventos",
popupID: "popup2"
}
},
'7': {
'13': {
content: "Teste",
className: "eventos",
popupID: "popup3"
}
},
'8': {
'9': {
content: "Teste",
className: "eventos",
popupID: "popup5"
}
},
'11': {
'6': {
content: "Teste",
className: "eventos",
popupID: "popup6"
}
}
}
};
$('#calendario').datepicker({
beforeShowDay: function(date) {
var d = date.getDate(),
m = date.getMonth()+1,
y = date.getFullYear();
if (specialDays[y] && specialDays[y][m] && specialDays[y][m][d]) {
var s = specialDays[y][m][d];
return [true, s.className, s.content]; // selectable
}
return [false,'']; // non-selectable
},
onSelect: function(dateText, inst){
var d = parseInt(dateText.split("/")[1], 10),
m = parseInt(dateText.split("/")[0], 10),
y = parseInt(dateText.split("/")[2], 10);
if ( specialDays[y][m][d].hasOwnProperty("popupID") ) {
var s = specialDays[y][m][d];
$('#' + s.popupID).dialog({
modal: true,
minWidth: 150,
minHeight: 150,
maxWidth:500,
maxHeight:350,
position: ['center', 300],
closeText: "Fechar",
draggable: false,
});
}else{
$('#popup').find('.date').text(dateText).end()
.dialog({
modal: true,
minWidth: 150,
minHeight: 150,
maxWidth:500,
maxHeight:350,
position: ['center'],
closeText: "Fechar",
draggable: false,
});
}
}
});
});
最佳答案
如果我不得不猜测,那是因为您不安全地加载jQuery UI。如果主页加载了HTTPS,浏览器将阻止非HTTPS元素的加载。
我建议您从提供HTTPS的位置(如Google)加载jQuery UI(类似于加载jQuery本身的方式),或将其自己托管在服务器上。
关于jquery - Facebook iframe中的jQuery无法在IE中加载,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16512183/