Can javascript be used to magnify or zoom in on an image? | XM Community
Solved

Can javascript be used to magnify or zoom in on an image?

  • 25 April 2019
  • 4 replies
  • 132 views

Badge +5
I'd like to run a heatmap question which displays an image made up of many smaller elements and I'm looking to use javascript to magnify or zoom in on the elements within the image
icon

Best answer by w.patrick.gale 1 May 2019, 19:28

View original

4 replies

Userlevel 5
Badge +13
Yes you can @DarryIS. I use https://github.com/elevateweb/elevatezoom.
Badge +5
Appreciate the response! I'm still very early on the learning curve of JS and Qualtrics. Maybe the better question to ask is what gaps do I need to fill to understand how to do this myself?
It appears the link you included has several examples depending on the type of zoom you'd like to accomplish. So a couple questions if you have time. In Qualtrics in the JS dialog box do I put the script in the addOnReady() section? And then... do I need to reference the image somehow?

Thanks!
Userlevel 5
Badge +13
DarrylS the first thing you need to do is get the image zoom working the way you want OUTSIDE of Qualtrics. Qualtrics will only add an additional layer of complexity. Look at this code as an example:
https://jsfiddle.net/Taqi_Shah/0zshgg1a/
(use something like jsfiddle, codepen, etc. to test it out, THEN you can work on importing into Qualtrics)
Badge +5
Thanks for the strategy of working outside of Qualtrics and then importing back into it after testing!

Leave a Reply