/** * turn.js 3rd release * www.turnjs.com * * Copyright (C) 2012, Emmanuel Garcia. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Any redistribution, use, or modification is done solely for personal * benefit and not for any commercial purpose or for monetary gain. * **/ (function($) { 'use strict'; var has3d, vendor ='', PI = Math.PI, A90 = PI/2, isTouch = 'ontouchstart' in window, events = (isTouch) ? {start: 'touchstart', move: 'touchmove', end: 'touchend'} : {start: 'mousedown', move: 'mousemove', end: 'mouseup'}, frameTime = (window.performance && window.performance.now) ? function() { return window.performance.now(); } : function() { return new Date().getTime(); }, requestFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { return window.setTimeout(function() { callback(frameTime()); }, 16); }, cancelFrame = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(handle) { window.clearTimeout(handle); }, turnEventNamespace = '.turn', turnFlipEventNamespace = '.turnFlip', // Contansts used for each corner // tl * tr // * * // bl * br corners = { backward: ['bl', 'tl'], forward: ['br', 'tr'], all: ['tl', 'bl', 'tr', 'br'] }, displays = ['single', 'double'], // Default options turnOptions = { // First page page: 1, // Enables gradients gradients: true, // Duration of transition in milliseconds duration: 600, // Enables hardware acceleration acceleration: true, // Display display: 'double', // Events when: null }, flipOptions = { // Back page folding: null, // Corners // backward: Activates both tl and bl corners // forward: Activates both tr and br corners // all: Activates all the corners corners: 'forward', // Size of the active zone of each corner cornerSize: 100, // Enables gradients gradients: true, // Duration of transition in milliseconds duration: 600, // Enables hardware acceleration acceleration: true }, // Number of pages in the DOM, minimum value: 6 pagesInDOM = 6, pagePosition = {0: {top: 0, left: 0, right: 'auto', bottom: 'auto'}, 1: {top: 0, right: 0, left: 'auto', bottom: 'auto'}}, baseStyleId = 'turn-js-base-css', baseStyles = [ '.turn-page{position:absolute;}', '.turn-page-wrapper,.turn-flip-wrapper,.turn-fold-wrapper,.turn-shadow{position:absolute;overflow:hidden;}', '.turn-fold-parent{position:absolute;overflow:visible;pointer-events:none;}', '.turn-fold-inner{position:absolute;overflow:visible;}', '.turn-fold-page{cursor:default;}', '.turn-back-shadow{overflow:hidden;}' ].join(''), ensureTurnCss = function() { if (!document.getElementById(baseStyleId)) $('