好吧,尝试使用fancybox来加载图片,它只是不起作用。我有什么明显的遗漏?
<!DOCTYPE html>
<html>
<head>
<title>fancybox test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css"></link>
<script type="text/javascript" src="http://cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function () {
$.fancybox.open([
{
href: "http://s3.amazonaws.com/media.vast.com/carstory/upload-745916ec-fcf9-4289-b2ff-4606f4cc521c",
title: 'test'
}
]);
});
</script>
</body>
</html>
答案 0 :(得分:0)
尝试使用document.ready:
<script type="text/javascript">
$(document).ready(function () {
$.fancybox({
'width': '50%',
'height': '50%',
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'iframe',
'href': 'http://s3.amazonaws.com/media.vast.com/carstory/upload-745916ec-fcf9-4289-b2ff-4606f4cc521c',
'title': 'test'
});
});
</script>