0
我無法獲得Fancybox適用於Durandal。我使用約翰帕帕的熱毛巾模板作爲我的出發點。Fancybox v2不適用於Durandal
問題:無論何時點擊圖像,它都會導航到圖像路徑,而不是將其覆蓋在頁面頂部。
程序庫:Jquery v 1.9.1 & FancyBox 2.1.4。
查看:
<section>
<a class="fancybox" title="Our fresh starters" href="http://www.preschools4all.com/image-files/little-bunny-foo-foo-1.jpg">
<img src="http://www.preschools4all.com/image-files/little-bunny-foo-foo-1.jpg" alt="Our fresh starters" />
</a>
</section>
視圖模型:
define(['services/logger', 'services/dataservice'], function (logger, dataservice) {
var vm = {
viewAttached: viewAttached,
activate: activate,
};
return vm;
function activate() {
//Do something
// return promise
}
function viewAttached() {
$(".fancybox").fancybox();
}
});
BundleConfig:
bundles.Add(
new ScriptBundle("~/scripts/vendor")
.Include("~/scripts/jquery-{version}.js")
.Include("~/scripts/jquery.fancybox.js")
.Include("~/scripts/bootstrap.js")
);
bundles.Add(
new StyleBundle("~/Content/css")
.Include("~/Content/ie10mobile.css")
.Include("~/Content/bootstrap.css")
.Include("~/Content/jquery.fancybox.css")
);
有什麼不對?
你包括fancybox css文件嗎? – JFK 2013-05-05 19:41:17
是的,我包括jquery.fancybox.css。我已將它添加到代碼段中。 – Yogesh 2013-05-05 21:19:20
看起來問題出在bootstrap.js v 2.3.0 Boostrap 2.3.0與fancybox v2不兼容。我升級了我的js文件到2.3.1,它工作。 P.S .: Stackoverflow不允許我回答自己的問題,直到我提出問題的時間爲止。 – Yogesh 2013-05-05 23:19:01