简体   繁体   English

杜兰达激活函数调用多次

[英]Durandal activate function call several times

The following code cause two calls in the activate function of the taginfos viewmodel, WHY ? 以下代码在taginfos视图模型的activate函数中导致两次调用,为什么?

$(oTag).fancybox({
   'overlayShow'       : true,
   'width'             : 800,
   'height'            : 500,
   'autoScale'         : true,
   'transitionIn'      : 'elastic',
   'transitionOut'     : 'elastic',
   'type'              : 'iframe',
   'scrolling'         : 'no',
   'href'              : 'http://localhost:1135/#/taginfos/' + item.tagId
});

You must not use jquery plugins inside the activate function. 您不得在Activate函数内使用jquery插件。 The DOM is not ready and the jquery selector might not find anything to give to fancybox. DOM尚未准备就绪,jquery选择器可能找不到要提供给fancybox的任何内容。 Put all your jquery plugin calls inside veiwActivated function. 将所有jquery插件调用都放在veiwActivated函数中。 This may not be a direct answer to your question 这可能不是您问题的直接答案

Here is an example: (Look at the question section) Fancybox v2 not working with Durandal 这是一个示例:(查看问题部分) Fancybox v2无法与Durandal一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM