Team:UT Dallas/Notebook

From 2012.igem.org

Revision as of 06:05, 28 September 2012 by Leah3393 (Talk | contribs)

__NOTOC__

<script type="text/javascript">

// Sample using dynamic pages with turn.js

var numberOfPages = 54;


// Adds the pages that the book will need function addPage(page, book) { // First check if the page is already in the book if (!book.turn('hasPage', page)) { // Create an element for this page var element = $('<div/>', {'class': 'page '+((page%2==0) ? 'odd' : 'even'), 'id': 'page-'+page}).html(''); // If not then add the page book.turn('addPage', element, page);

                       element.load("https://2012.igem.org/Team:UT_Dallas/notebook_data #page"+page);

} }

$(window).ready(function(){ $('#book').turn({acceleration: true, pages: numberOfPages, elevation: 0, gradients: !$.isTouch, when: { turning: function(e, page, view) { var range = $(this).turn('range', page); for (page = range[0]; page<=range[1]; page++) addPage(page, $(this)); }, } }); $("#book").bind("turned", function(event, page, view) { if(page==2) { $('#book').animate({ left: '112px' }, 500, function() { // Animation complete. }); } }); $("#book").bind("first", function(event) { $('#book').animate({ left: '-155px' }, 500, function() { // Animation complete. }); }); $("#book").bind("last", function(event) { $('#book').animate({ left: '-155px' }, 500, function() { // Animation complete. }); }); });

</script> </html>