Interactive Image Viewer with HTML Maps – Panelize
<map> coordinates.
1. Load the Load Panelize as an ES module:
import { Panelize } from './panelize.js'; 2. Wrap your image and the corresponding map in a container element. You must apply the data-panelize attribute to this container. The container requires explicit width and height dimensions. The <map> element must reside inside this container.
<!-- Set a fixed viewer size for stable scaling -->
<div id="viewer" data-panelize style="width: 800px; height: 520px;">
<!-- Use a real image and connect it to the map -->
<img src="storyboard.jpg" usemap="#story-panels" alt="Storyboard panels" />
<map name="story-panels">
<!-- Each area defines one panel in image coordinates -->
<area coords="0,0,400,260" />
<area coords="400,0,800,260" />
<area coords="0,260,800,520" />
</map>
</div>
<!-- Navigation Controls -->
<button id="btnPrevPanel">Previous</button>
<button id="btnNextPanel">Next</button> 3. You can initialize the library programmatically via JavaScript. This provides advanced control over the configuration.
fullImageStart (boolean): Shows the full scaled image first.nextBtn (string): Sets the CSS selector for the forward button.prevBtn (string): Sets the CSS selector for the backward button.// Initialize the library on the specific container
const presentationViewer = new Panelize(document.querySelector('#presentation-canvas'), {
fullImageStart: true,
nextBtn: '#btn-forward',
prevBtn: '#btn-backward'
}); 4. You can also pass the options via HTML data attributes:
<div id="viewerConfigured" data-panelize data-full-image-start="false" data-next-btn="#btnNextPanel" data-prev-btn="#btnPrevPanel" style="width: 900px; height: 560px;" > <!-- Image and map go here --> </div>
5. API methods.
// Show the full scaled image view
instance.showFullImage();
// Move to the next or previous panel
instance.transformPanel('next');
instance.transformPanel('prev'); The post Interactive Image Viewer with HTML Maps – Panelize appeared first on CSS Script.
INDIANAPOLIS, IND. (WOWO) Indiana’s population increased by 38,579 residents in 2025, bringing the state’s total…
LAKEVILLE, IND. (WOWO) Residents in Lakeville expressed concern Wednesday night over whether the county has…
FORT WAYNE, IND. (WOWO) City leaders have approved two new programs aimed at repairing sidewalks…
Visual experiments suggest just a small fraction of the information our brains process enters awareness.…
If your brand isn’t showing up in ChatGPT, Perplexity, or Google’s AI Overviews, you’re missing…
Did you know that more than 90% of IT companies have no preparedness plan for…
This website uses cookies.