我已经完成了一个带有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,
});
}
}
});
});
答案 0 :(得分:1)
如果我不得不猜测,那是因为你不安全地加载了jQuery UI。如果主页加载了HTTPS,浏览器将阻止加载非HTTPS元素。
我建议您从提供类似Google的HTTPS的位置加载jQuery UI(类似于加载jQuery本身的方式),或者自己在服务器上托管它。