我已经完成了一个带有 UI 数据选择器的页面来显示事件,我正试图将它放在一个 facebook 页面选项卡中。除了 IE,所有浏览器都可以正常工作。
这可能是初学者的愚蠢猜测,但我认为问题出在 DOCTYPE 上。问题是当它只是一个页面时,IE 会正确加载它。就在我将它放在 facebook iframe 中时,即使声明了 doctype,jquery 也根本不会加载。我已经尝试了很多东西,但我不知道发生了什么。有人可以帮助我吗?
的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,
});
}
}
});
});