Jquery plugins jQuery没有';不能在角度视图中正常工作
我想在AngularJS项目中添加Jquery plugins jQuery没有';不能在角度视图中正常工作,jquery-plugins,angularjs,Jquery Plugins,Angularjs,我想在AngularJS项目中添加multizoom.js 这是我的索引页: <body> <img id="zoom" ng-src="example.jpg" class="example ng-class"> <div ng-view> </div> </body> 这是详细页面: <img id="zoom" ng-src="example.jpg" class="example ng-class"&
multizoom.js
这是我的索引页:
<body>
<img id="zoom" ng-src="example.jpg" class="example ng-class">
<div ng-view> </div>
</body>
这是详细页面:
<img id="zoom" ng-src="example.jpg" class="example ng-class">
我的问题是jQuery multizoom插件不能缩放AngularJS的ng视图部分中的图像
如果图像不在ng视图中,部分多重缩放效果良好。这是因为我假定您正在使用
$(function(){/*…(multizoom init code).*/})初始化DOM就绪事件上的多重缩放行为
或$(document).ready(function(){/*…(multizoom init code)).*/
。如果是这样,将只运行一次,并且很可能是在详细信息页面加载到
之前。因此,它将无法在正在搜索的页面上找到图像,因为它尚未加载
相反,只要加载了ng视图
内容,您就需要初始化多重缩放功能,如:
// (inside some function with $rootScope available)
$rootScope.$on('$viewContentLoaded', function() {
// ... (multiview init code here) ...
});
这有意义吗
作为一个小提示,不要让多个元素具有相同的ID,这不是一个好主意。相反,使用类来表示要应用多重缩放插件的图像