Creating a Turn.js interactive book similar to the provided example?

I'm in the process of creating a book using turn.js with Jquery and everything is going smoothly so far. However, I could use some assistance. I am trying to achieve the look of a hard-backed journal-type book similar to the example provided here . My main question is, how can I make the pages of the book smaller than the front and back covers? Additionally, how can I implement a feature where turning the pages visibly builds up on the other side like in the example?

Could someone please help me modify the code on my main page below to achieve the desired effect?

<!doctype html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/turn.js"></script>
<style type="text/css">
    body{
        background:#ccc;
        }
    #magazine{
        width:1002px;
        height:773px;
    }
    #magazine .turn-page{
        background-color:#ccc;
        background-size:100% 100%;
    }
</style>
</head>
<body>
    <div id="magazine">
        <div class="hard">A Book</div>
        <div class="hard"></div>
        <div>Page 1</div>
        <div>Page 2</div>
        <div>Page 3</div>
        <div>Page 4</div>
        <div>Page 5</div>
        <div>Page 6</div>
        <div>Page 7</div>
        <div>Page 8</div>
        <div class="hard"></div>
        <div class="hard"></div>
     </div>
    <script type="text/javascript">
        $(window).ready(function() {
            $('#magazine').turn({
                                display: 'double',
                                acceleration: true,
                                gradients: !$.isTouch,
                                elevation:50,
                                when: {
                                    turned: function(e, page) {
                                         /*console.log('Current view: ', $(this).turn('view'));*/
                                    }
                                }
                             });
        });
        $(window).bind('keydown', function(e){
            if (e.keyCode==37)
                $('#magazine').turn('previous');
            else if (e.keyCode==39)
                $('#magazine').turn('next');
        });
    </script>
    </body>
    </html>

Answer №1

To adjust the dimensions of your pages, simply apply the CSS class own-size and set a custom size for each page. Refer to this documentation for more details.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The difference between calling a function in the window.onload and in the body of a

In this HTML code snippet, I am trying to display the Colorado state flag using a canvas. However, I noticed that in order for the flag to be drawn correctly, I had to move certain lines of code from the window.onload() function to the drawLogo() function. ...

Creating a seamless and captivating animation loop for continuous horizontal scrolling using HTML and CSS

I'm currently working on adding a continuous keyframe animation to the background image in the hero section of a page, using the translateX property for animation. While it is functioning properly, I am encountering an issue where the animation abrup ...

The ReactJS input box is stubbornly rejecting all input

Struggling with this code and can't seem to figure out why the input lines aren't accepting anything. After searching extensively, I decided it was time to ask for help. P.S. I am new to react class App extends React.Component { state = { inp ...

Simple steps to successfully pass two parameters to jsonpCallback

Hey there! Below is the code snippet where I am using an ajax call in jQuery to invoke function 1 named "setEmailAFriendCount". In this function, we are passing a variable with JSON data type. However, I now need to call the same function from an ajax call ...

Improprove Google PageSpeed score - must resolve

My mobile website is loading incredibly slow, despite my attempts to improve the speed using Google PageSpeed insights. Unfortunately, I'm having trouble interpreting the screenshot and identifying what changes need to be made. Is there anyone who c ...

The bottom of the page showcases the menu element

I have been utilizing Bootstrap to display a navigation bar: https://i.sstatic.net/P9maf.png In the provided screenshot, you can observe that the first menu item is positioned at the lower level compared to the rest of the menu elements. Below are the CS ...

What is the process for determining the total of elements within an array?

Imagine you have the following array: const items = [ { "amount1": "100", "amount2": "50", "name": "ruud" }, { "amount1": "40", "amount2": "60", "name": "ted" } ] Your goal is to calculate the sum of all amount1 and amount ...

Issue with Angular 2 (Ionic 2): Struggling to properly display Component within Page

I have successfully created an Angular 2 Component: import {Component, View} from 'angular2/core'; @Component({ selector: 'sidemenu' }) @View({ templateUrl: 'build/pages/menu/menu.html', }) export class Menu { } Howev ...

Encountering issues with trailing bytes error in redis 3.0.6 when using socket.io-redis

Utilizing phpredis for transmitting data to node.js through the pubsub method brought about an issue after upgrading node.js to stable version 4.2, resulting in a trailing byte error from the socket.io-redis module. Here is the code snippet in question: ...

Implementing complex routing with Express.js on top of Node.js

Recently delving into the world of javascript, I have embarked on creating a RESTful API using Node.js and Express.js Here is the breakdown of my directory structure: /server.js /api/api.js /api/location/location.js My goal is to make the API modular, ...

Join the nested object using the delimiter ';'

My objective is to concatenate all values from an object using a semi-colon as separator. This process works perfectly when the object consists of just one level: obj = { name: "one" additionalInfo: "hello" ... }; Object.values(obj).join(&ap ...

How does the functionality of $.ajax differ from that of $.get?

Similar Inquiry: Understanding the Variations of $.ajax(), $.get(), and $.load() I'm curious about the disparities between $.get() and $.ajax The given code showcases calls like this: $.get(href) .success(function (content) { $(&apos ...

Implement a feature on React using hooks that detects when a user clicks

I'm attempting to utilize React hooks to check if a user has clicked outside of an element. I'm using useRef to grab a reference to the element. Could someone help me troubleshoot this? I'm encountering the following errors and referencing ...

Struggling to vertically align elements within iron-pages

Struggling to vertically center the content within iron-pages (nested in a paper-drawer-panel). Check out the code snippet below: <paper-drawer-panel id="drawerPanel" responsive-width="1280px"> <div class="nav" drawer> <!-- Nav Conte ...

Tips for resolving the error message: React is not able to identify the `currentSlide` and `slideCount` prop on a DOM element

I recently implemented an image slider using "react-slick" in my next.js project. However, I encountered some warnings in the console related to the 'currentSlide' and 'slideCount' props on a DOM element. Warning: React does not recogni ...

Creating dynamic textures through the use of canvas and Three.js rotation

I am attempting to rotate a texture on a single face of a cube using Three.js. Since I am generating the cube multiple times with different textures, I am utilizing a function that creates the material and mesh with a texture parameter. However, I need t ...

Using the $.ajax() method can sometimes lead to encountering the error message "Uncaught ReferenceError: data is not defined"

I experimented with different methods to retrieve .json files and data using $.getJSON and $.ajax() here The issue I encountered with my JS code number 2 is: $.ajax({ type: "GET", url: 'js/main.js', data: data, success: 1, }).done(fun ...

Enhancing a video tag with a mysterious dark mask

I'm looking for a way to darken a video in my hero section to make it easier to see the white menu items that are getting lost in the brightness. Any tips on how to achieve this using CSS or Bootstrap? <template> <section class="se ...

Configuring environment variables during Jest execution

A variable is defined in my `main.ts` file like this: const mockMode = process.env.MOCK_MODE; When I create a test and set the variable to true, it doesn't reflect as `'true'` in the main file, but as `'false'` instead. describe ...

Utilizing jQuery to assign test classes to dynamic elements on web pages

Currently collaborating with a tester who is utilizing Selenium for the latest project. I attempted to gather details from him on how I should name the CSS classes for dynamic elements that will be tested. It seems he may also be new to this, so we decid ...