How do you change the height of a zoom.it viewer?

  • 1
  • Question
  • Updated 8 years ago
Using the zoom.it API, how do I return a
Photo of Matthew Butler

Matthew Butler

  • 3 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 1
Photo of Bill Crow

Bill Crow, Seadragon Group Manager

  • 100 Posts
  • 38 Reply Likes
If you look at the embed tag created at the zoom.it site for your image, you can see where both the height and width are specified as parameters. By default, the height is set to 400 pixels and the width will auto-adjust to the page. You can explicitly set the height to a different value, and you can also set the width explicitly, rather than allowing it to auto-size to the page.

Here's an example from one of my images. This text is a portion of the embed string created by zoom.it. You can see the default height value of 400px, which you can change as desired when you use this embed code.

script src="hxxp://zoom.it/fbi.js?width=auto&height=400px"

(I changed http to hxxp so getsatisfaction.com wouldn't convert it to a link.)

Bill
Photo of Matthew Butler

Matthew Butler

  • 3 Posts
  • 0 Reply Likes
I am generating these embed tags with the API though and can't manually change the height in the embed code. I suppose I could use jQuery or something to fiddle with it in the document object but I was just wondering if there was a cleaner way to make an API call and have it return a specified height. Thanks!
Photo of Bill Crow

Bill Crow, Seadragon Group Manager

  • 100 Posts
  • 38 Reply Likes
You will have to parse and modify the returned embedHTML string to change the height. However, because the return string will always have a height value of 400, this isn't too hard to parse. I agree, it's not as clean as an API parameter, but that's the only option available.

Bill
Photo of Matthew Butler

Matthew Butler

  • 3 Posts
  • 0 Reply Likes
Ok, I'll do that. Thanks for your answer.