Categories:

Home / Free JavaScripts / Images & Music / Here

Cut & Paste JK Pop-up image viewer

Credit: JavaScript Kit

Description: Use this feature-rich image viewer script to allow your visitors to selectively choose an image to view, by clicking on a link. The image is launched in a separate, fit window. Features that set this script apart from others are:

  • Supports a text description, displayed beneath the image.

  • Ability to set a background color/image for the pop up window.

  • Only one pop up window open at all times to avoid agitation. For example, if the user clicks on multiple links to view multiple images, the same pop up window is used, instead of spawning a new one for each image.

  • Pop up window is centered on page the first time it's activated. Subsequent calls to it are not, so the user may choose to drag the window to a custom location if desired.

Example: 

- Breakfast pancakes
- Lemon Cake
- MeatLoaf

Directions

Step 1: Simply copy the below code into the <head> section of your page:

Step 2: Set up the image viewer link, something like the below:

<a href="#" onClick="jkpopimage('food1.jpg', 325, 445, 'Breakfast is served.'); return false">
Breakfast pancakes</a>

Where "food1.jpg" is the src of the image, and following that, the pop up window's width and height, and finally, an optional text description (set it to '' for none).

Enjoy this useful script!


JavaScript Tools:
Site Info


CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info