Javascript 如何避免Photoswip在SmartSevice中缩放到图像原始大小?
我使用带有angularJS的Photosweep来显示图像。但是当我在SmartDevice中单击图像时,默认模式设置为“zoomIn”,它太大,无法看到图像 我是说,当我点击像这样的图片 它变成了这样: 但我希望它成为默认值: 这是html:Javascript 如何避免Photoswip在SmartSevice中缩放到图像原始大小?,javascript,angularjs,photoswipe,Javascript,Angularjs,Photoswipe,我使用带有angularJS的Photosweep来显示图像。但是当我在SmartDevice中单击图像时,默认模式设置为“zoomIn”,它太大,无法看到图像 我是说,当我点击像这样的图片 它变成了这样: 但我希望它成为默认值: 这是html: <a ng-click="showZoom(page.page);"> <img ng-src="{{page.imageUrl}}" > &
<a ng-click="showZoom(page.page);">
<img ng-src="{{page.imageUrl}}" >
</a>
我解决了这个问题。
这是因为我使用了“ngTouch”,这会导致“ng click”触发两次,就像双击一样
在Photosweep中,双击表示缩放,因此
我删除“ngTouch”并得到解决
$scope.showZoom = function (pageNo) {
var items = new Array();
items.push(
{
src: $scope.pages[0].imageUrl,
w: 1400,
h: 700
});
var currentIndex = 0;
if (pageNo === 1)
currentIndex = 1;
if (pageNo >= 2)
currentIndex = pageNo / 2 + 1;
//オプションの設定
var options = {
history: false,
focus: false,
index: currentIndex,
showAnimationDuration: 0,
hideAnimationDuration: 0,
};
var pswpElement = document.querySelectorAll('.pswp')[0];
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
}