3

I want to dynamically resize an image map. I only found a solution for jQuery (https://github.com/stowball/jQuery-rwdImageMaps)

How can I realize this in Angular?

hfs23
  • 125
  • 1
  • 1
  • 9

2 Answers2

0

you can use https://github.com/davidjbradshaw/image-map-resizer It works with javascript call :

sample

in HTML :

 <img src="...." width="100%"  usemap="#usaMap" (load)="imageResized();">

in TS :

declare function imageMapResize(): void;

@Component({...

})
...
imageResized() {
  imageMapResize(); // Javascript function in imageMapResizer.min.js 
}
FeelCode
  • 491
  • 4
  • 5
0

Previous answer works, however, you have to download the imageMapResizer.min.js into the assets folder.

Then, you should import it in the index.html file like this:

<script src="./assets/imageMapResizer.min.js"></script>

I thought that the file should be imported in the angular.json file, but it didn't work ... index.html did the trick for me.

Tomas Lukac
  • 1,923
  • 2
  • 19
  • 37