{"id":1390,"date":"2019-03-28T13:18:32","date_gmt":"2019-03-28T07:48:32","guid":{"rendered":"http:\/\/blog.openwebsolutions.in\/?p=1390"},"modified":"2019-03-28T13:18:32","modified_gmt":"2019-03-28T07:48:32","slug":"create-own-flipbook-with-turnjs","status":"publish","type":"post","link":"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/","title":{"rendered":"Create Your Own Flipbook with Turnjs"},"content":{"rendered":"<p>Hello guys, Today I am introducing a simple example of how can we make an image flipbook with the help of Turn JS. Turn JS is nothing but a JavaScript library that helps us to create beautiful magazines or books like user view with the advantage of HTML5.<\/p>\n<p>Here is the html part, first you need to add some cdns like jquery and turn js modernizr<br \/>\n&lt;!doctype html&gt;<br \/>\n&lt;html lang=&#8221;en&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;meta name=&#8221;viewport&#8221; content=&#8221;width = 1050, user-scalable = no&#8221; \/&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221; src=&#8221;.\/jquery.min.1.7.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221; src=&#8221;.\/modernizr.2.5.3.min.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body style=&#8221;background-color:brown&#8221;&gt;<\/p>\n<p>&lt;div class=&#8221;flipbook-viewport&#8221; style=&#8221;margin:35px;&#8221;&gt;<br \/>\n&lt;div class=&#8221;container&#8221; &gt;<br \/>\n&lt;div class=&#8221;flipbook&#8221; &gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>Next part is to append some images to that &#8220;flipbook class&#8221;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n$(document).ready(() =&gt; {<br \/>\n$(&#8216;.flipbook&#8217;).append(`&lt;div style=&#8221;background-color:grey;color:orange;padding:215px;&#8221; class=&#8221;hard&#8221;&gt;&lt;h1&gt;Welcome&lt;\/h1&gt;&lt;\/div&gt;`)<br \/>\n$(&#8216;.flipbook&#8217;).append(`&lt;div style=&#8221;background-color:white;&#8221; class=&#8221;hard&#8221;&gt;&lt;\/div&gt;`)<br \/>\nfor(let i=1; i&lt;=10; i++) {<br \/>\n$(&#8216;.flipbook&#8217;).append(`&lt;div style=&#8221;background-image:url(images\/${i}.jpg)&#8221;&gt;&lt;\/div&gt;`)<br \/>\n}<br \/>\n$(&#8216;.flipbook&#8217;).append(`&lt;div style=&#8221;background-color:white;&#8221; class=&#8221;hard&#8221;&gt;&lt;\/div&gt;`)<br \/>\n$(&#8216;.flipbook&#8217;).append(`&lt;div style=&#8221;background-color:grey;color:orange;padding:215px;&#8221; class=&#8221;hard&#8221;&gt;&lt;h1&gt;Good Bye&lt;\/h1&gt;&lt;\/div&gt;`)<\/p>\n<p>})<br \/>\n&lt;\/script&gt;<br \/>\nhere, class &#8220;hard&#8221; means the image is not foldable just like book cover. You can give better design to this.<\/p>\n<p>Okay let&#8217;s move to the next part. This part is to call the turn method..<br \/>\n&lt;script&gt;<br \/>\nfunction loadApp() {<br \/>\n$(&#8216;.flipbook&#8217;).turn({<br \/>\nwidth:922,<br \/>\nheight:600,<br \/>\nelevation: 50,<br \/>\ngradients: true,<br \/>\nautoCenter: true<br \/>\n});<br \/>\n}<br \/>\n&lt;\/script&gt;<br \/>\nHere, the &#8220;elevation&#8221; keyword sets the elevation of the page during the transition, &#8220;gradients&#8221; keyword shows gradients or shadows during the transition and the last one &#8220;autoCenter&#8221; is used to keep the flipbook centered.<br \/>\nOf course you can add more keywords to get various transition effect of your flipbook. You can get whole documentation here, &#8220;http:\/\/www.turnjs.com\/&#8221;<\/p>\n<p>Finally we will append some styles and turnJS css and js, that you will found attached below or from tranjs official website.<br \/>\n&lt;script&gt;<br \/>\nyepnope({<br \/>\ntest : Modernizr.csstransforms,<br \/>\nyep: [&#8216;.\/turn.js&#8217;],<br \/>\nnope: [&#8216;.\/turn.html4.min.js&#8217;],<br \/>\nboth: [&#8216;.\/basic.css&#8217;],<br \/>\ncomplete: loadApp<br \/>\n});<br \/>\n&lt;\/script&gt;<\/p>\n<p>Thanks for reading this interesting blog. It may help you in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello guys, Today I am introducing a simple example of how can we make an image flipbook with the help of Turn JS. Turn JS is nothing but a JavaScript library that helps us to create beautiful magazines or books like user view with the advantage of HTML5. Here is the html part, first you [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":1474,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[49,72,18,5,1],"tags":[53,73,111,107,110],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Your Own Flipbook with Turnjs<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Your Own Flipbook with Turnjs\" \/>\n<meta property=\"og:description\" content=\"Hello guys, Today I am introducing a simple example of how can we make an image flipbook with the help of Turn JS. Turn JS is nothing but a JavaScript library that helps us to create beautiful magazines or books like user view with the advantage of HTML5. Here is the html part, first you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/\" \/>\n<meta property=\"og:site_name\" content=\"Openweb Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-28T07:48:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/flipbook.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/\",\"name\":\"Openweb Solutions Blog\",\"description\":\"Transforming ideas into reality\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/openwebsolutions.in\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/flipbook.png\",\"width\":1920,\"height\":1080},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/#webpage\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/\",\"name\":\"Create Your Own Flipbook with Turnjs\",\"isPartOf\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/#primaryimage\"},\"datePublished\":\"2019-03-28T07:48:32+00:00\",\"dateModified\":\"2019-03-28T07:48:32+00:00\",\"author\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/94b954bfc8509d2e1082440aba4e21a9\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/openwebsolutions.in\/blog\/create-own-flipbook-with-turnjs\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/94b954bfc8509d2e1082440aba4e21a9\",\"name\":\"Ayan Biswas\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/610c50a0da97f116273fa6d89d3b1e24?s=96&r=g\",\"caption\":\"Ayan Biswas\"},\"description\":\"Web Developer at Openweb Solutions\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1390"}],"collection":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=1390"}],"version-history":[{"count":3,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1390\/revisions"}],"predecessor-version":[{"id":1476,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1390\/revisions\/1476"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media\/1474"}],"wp:attachment":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=1390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=1390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=1390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}