简体   繁体   English

如何在 Angular 9 中使用 ngx-image-zoom 在 hover 上的图像旁边显示图像缩放弹出窗口?

[英]How to display image zoom popup beside image on hover using ngx-image-zoom in Angular 9?

image-zoom for zooming a product image on mouse hover but i want that when user hover mouse on that image, a div that displays the zoomed image pops beside the image like we get on amazon. image-zoom 用于在鼠标 hover 上缩放产品图像,但我希望当用户 hover 鼠标在该图像上时,显示缩放图像的 div 会像我们在亚马逊上一样弹出图像旁边。 I am not able to understand how to do that using ngx-image-zoom.我无法理解如何使用 ngx-image-zoom 做到这一点。

app.html应用程序.html

  <h1>
    {{title}}
  </h1>
  <lib-ngx-image-zoom
      [thumbImage]=myThumbnail
      [fullImage]=myFullresImage
   ></lib-ngx-image-zoom>

app.ts应用程序.ts

    myThumbnail="https://wittlock.github.io/ngx-image-zoom/assets/thumb.jpg";
  myFullresImage="https://wittlock.github.io/ngx-image-zoom/assets/fullres.jpg";

Or is there any other plugin or library i can use to implement this easily?或者是否有任何其他插件或库我可以用来轻松实现这一点?

Have you imported NgxImageZoomModule in your module as instructed in the npm page of this library?您是否按照该库的 npm 页面中的说明在模块中导入了 NgxImageZoomModule?

Try using ng-img-magnifier npm package .尝试使用ng-img-magnifier npm package Here is a working DEMO .这是一个有效的演示 Very easy to implement and fully customizable.非常易于实施且完全可定制。

<ng-img-magnifier [thumbImage]='img' [fullImage]='img2'
    [top]='top' [right]='right'
    [lensWidth]='lensewidth' [lensHeight]='lensheight'
    [resultWidth]='resultWidth' [resultHeight]='resultheight'
    [imgWidth]='imgWidth' [imgHeight]='imgheight'>
</ng-img-magnifier>

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

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