Event: resize

From Turn.js Documentation
Jump to navigation Jump to search

This event is triggered when after zoomIn or zoomOut is called. It's designed to perform the resize operation over the pages of the flipbook. Therefore, the resize will be fired when a page might be resized.

Argument Type Description
event Object Event Object
zoomValue Number The new zoom value
page Number The number of the page that must be resized
pageElement jQuery Element The page element


$("#zoom-view").bind("zoom.resize", function(event, newZoom, page, pageElement) {
	if (newZoom==1) 
		loadDefaultPage(page, pageElement);
	else if (newZoom==1) 
		loadLargePage(page, pageElement);

// Load large pages

function loadLargePage(page, pageElement) {
	var img = $("<img />");

	img.load(function() {
		var prevImg = pageElement.find("img");
		$(this).css({width: "100%", height: "100%"});

	// Loadnew page
	img.attr("src", "pages/"+  page + "-large.jpg");

// Load small pages
function loadDefaultPage(page, pageElement) {
		img.css({width: "100%", height: "100%"}).
		attr("src", "pages/" +  page + "-default.jpg");

<yambe:breadcrumb>Zoom Events</yambe:breadcrumb>