Problems, need help? Have a tip or advice? Post it here.
11 posts Page 1 of 2
Ive just created a flipbook slider using turn.js on a separate page called flipbook.php......As I look at the code.I've made it clonable because my client might need to create several flipbooks but I'm lost as to how to create the couch tags on this to make it to where my client can upload each page one by one to the particular flipbook and if needed can click add new to make another flipbook doing the same thing.also able to add as many or little pages as they want....I will attach this to my slider on the index.php.....Can you steer me the correct way? thank you once again
Code: Select all
<div id="canvas">

<div class="zoom-icon zoom-icon-in"></div>

<div class="magazine-viewport">
   <div class="container">
      <div class="magazine">
         <!-- Next button -->
         <div ignore="1" class="next-button"></div>
         <!-- Previous button -->
         <div ignore="1" class="previous-button"></div>
      </div>
   </div>
</div>

<!-- Thumbnails -->
<div class="thumbnails">
   <div>
      <ul>
         <li class="i">
            <img src="pages/1-thumb.jpg" width="76" height="100" class="page-1">
            <span>1</span>
         </li>
         <li class="d">
            <img src="pages/2-thumb.jpg" width="76" height="100" class="page-2">
            <img src="pages/3-thumb.jpg" width="76" height="100" class="page-3">
            <span>2-3</span>
         </li>
         <li class="d">
            <img src="pages/4-thumb.jpg" width="76" height="100" class="page-4">
            <img src="pages/5-thumb.jpg" width="76" height="100" class="page-5">
            <span>4-5</span>
         </li>
         <li class="d">
            <img src="pages/6-thumb.jpg" width="76" height="100" class="page-6">
            <img src="pages/7-thumb.jpg" width="76" height="100" class="page-7">
            <span>6-7</span>
         </li>
         <li class="d">
            <img src="pages/8-thumb.jpg" width="76" height="100" class="page-8">
            <img src="pages/9-thumb.jpg" width="76" height="100" class="page-9">
            <span>8-9</span>
         </li>
         <li class="d">
            <img src="pages/10-thumb.jpg" width="76" height="100" class="page-10">
            <img src="pages/11-thumb.jpg" width="76" height="100" class="page-11">
            <span>10-11</span>
         </li>
         <li class="i">
            <img src="pages/12-thumb.jpg" width="76" height="100" class="page-12">
            <span>12</span>
         </li>
      <ul>
   <div>   
</div>
</div>

<script type="text/javascript">

function loadApp() {

   $('#canvas').fadeIn(1000);

   var flipbook = $('.magazine');

   // Check if the CSS was already loaded
   
   if (flipbook.width()==0 || flipbook.height()==0) {
      setTimeout(loadApp, 10);
      return;
   }
   
   // Create the flipbook

   flipbook.turn({
         
         // Magazine width

         width: 922,

         // Magazine height

         height: 600,

         // Duration in millisecond

         duration: 1000,

         // Hardware acceleration

         acceleration: !isChrome(),

         // Enables gradients

         gradients: true,
         
         // Auto center this flipbook

         autoCenter: true,

         // Elevation from the edge of the flipbook when turning a page

         elevation: 50,

         // The number of pages

         pages: 12,

         // Events

         when: {
            turning: function(event, page, view) {
               
               var book = $(this),
               currentPage = book.turn('page'),
               pages = book.turn('pages');
         
               // Update the current URI

               Hash.go('page/' + page).update();

               // Show and hide navigation buttons

               disableControls(page);
               

               $('.thumbnails .page-'+currentPage).
                  parent().
                  removeClass('current');

               $('.thumbnails .page-'+page).
                  parent().
                  addClass('current');



            },

            turned: function(event, page, view) {

               disableControls(page);

               $(this).turn('center');

               if (page==1) {
                  $(this).turn('peel', 'br');
               }

            },

            missing: function (event, pages) {

               // Add pages that aren't in the magazine

               for (var i = 0; i < pages.length; i++)
                  addPage(pages[i], $(this));

            }
         }

   });

   // Zoom.js

   $('.magazine-viewport').zoom({
      flipbook: $('.magazine'),

      max: function() {
         
         return largeMagazineWidth()/$('.magazine').width();

      },

      when: {

         swipeLeft: function() {

            $(this).zoom('flipbook').turn('next');

         },

         swipeRight: function() {
            
            $(this).zoom('flipbook').turn('previous');

         },

         resize: function(event, scale, page, pageElement) {

            if (scale==1)
               loadSmallPage(page, pageElement);
            else
               loadLargePage(page, pageElement);

         },

         zoomIn: function () {

            $('.thumbnails').hide();
            $('.made').hide();
            $('.magazine').removeClass('animated').addClass('zoom-in');
            $('.zoom-icon').removeClass('zoom-icon-in').addClass('zoom-icon-out');
            
            if (!window.escTip && !$.isTouch) {
               escTip = true;

               $('<div />', {'class': 'exit-message'}).
                  html('<div>Press ESC to exit</div>').
                     appendTo($('body')).
                     delay(2000).
                     animate({opacity:0}, 500, function() {
                        $(this).remove();
                     });
            }
         },

         zoomOut: function () {

            $('.exit-message').hide();
            $('.thumbnails').fadeIn();
            $('.made').fadeIn();
            $('.zoom-icon').removeClass('zoom-icon-out').addClass('zoom-icon-in');

            setTimeout(function(){
               $('.magazine').addClass('animated').removeClass('zoom-in');
               resizeViewport();
            }, 0);

         }
      }
   });

   // Zoom event

   if ($.isTouch)
      $('.magazine-viewport').bind('zoom.doubleTap', zoomTo);
   else
      $('.magazine-viewport').bind('zoom.tap', zoomTo);


   // Using arrow keys to turn the page

   $(document).keydown(function(e){

      var previous = 37, next = 39, esc = 27;

      switch (e.keyCode) {
         case previous:

            // left arrow
            $('.magazine').turn('previous');
            e.preventDefault();

         break;
         case next:

            //right arrow
            $('.magazine').turn('next');
            e.preventDefault();

         break;
         case esc:
            
            $('.magazine-viewport').zoom('zoomOut');   
            e.preventDefault();

         break;
      }
   });

   // URIs - Format #/page/1

   Hash.on('^page\/([0-9]*)$', {
      yep: function(path, parts) {
         var page = parts[1];

         if (page!==undefined) {
            if ($('.magazine').turn('is'))
               $('.magazine').turn('page', page);
         }

      },
      nop: function(path) {

         if ($('.magazine').turn('is'))
            $('.magazine').turn('page', 1);
      }
   });


   $(window).resize(function() {
      resizeViewport();
   }).bind('orientationchange', function() {
      resizeViewport();
   });

   // Events for thumbnails

   $('.thumbnails').click(function(event) {
      
      var page;

      if (event.target && (page=/page-([0-9]+)/.exec($(event.target).attr('class'))) ) {
      
         $('.magazine').turn('page', page[1]);
      }
   });

   $('.thumbnails li').
      bind($.mouseEvents.over, function() {
         
         $(this).addClass('thumb-hover');

      }).bind($.mouseEvents.out, function() {
         
         $(this).removeClass('thumb-hover');

      });

   if ($.isTouch) {
   
      $('.thumbnails').
         addClass('thumbanils-touch').
         bind($.mouseEvents.move, function(event) {
            event.preventDefault();
         });

   } else {

      $('.thumbnails ul').mouseover(function() {

         $('.thumbnails').addClass('thumbnails-hover');

      }).mousedown(function() {

         return false;

      }).mouseout(function() {

         $('.thumbnails').removeClass('thumbnails-hover');

      });

   }


   // Regions

   if ($.isTouch) {
      $('.magazine').bind('touchstart', regionClick);
   } else {
      $('.magazine').click(regionClick);
   }

   // Events for the next button

   $('.next-button').bind($.mouseEvents.over, function() {
      
      $(this).addClass('next-button-hover');

   }).bind($.mouseEvents.out, function() {
      
      $(this).removeClass('next-button-hover');

   }).bind($.mouseEvents.down, function() {
      
      $(this).addClass('next-button-down');

   }).bind($.mouseEvents.up, function() {
      
      $(this).removeClass('next-button-down');

   }).click(function() {
      
      $('.magazine').turn('next');

   });

   // Events for the next button
   
   $('.previous-button').bind($.mouseEvents.over, function() {
      
      $(this).addClass('previous-button-hover');

   }).bind($.mouseEvents.out, function() {
      
      $(this).removeClass('previous-button-hover');

   }).bind($.mouseEvents.down, function() {
      
      $(this).addClass('previous-button-down');

   }).bind($.mouseEvents.up, function() {
      
      $(this).removeClass('previous-button-down');

   }).click(function() {
      
      $('.magazine').turn('previous');

   });


   resizeViewport();

   $('.magazine').addClass('animated');

}

// Zoom icon

$('.zoom-icon').bind('mouseover', function() {
   
   if ($(this).hasClass('zoom-icon-in'))
      $(this).addClass('zoom-icon-in-hover');

   if ($(this).hasClass('zoom-icon-out'))
      $(this).addClass('zoom-icon-out-hover');

}).bind('mouseout', function() {
   
    if ($(this).hasClass('zoom-icon-in'))
      $(this).removeClass('zoom-icon-in-hover');
   
   if ($(this).hasClass('zoom-icon-out'))
      $(this).removeClass('zoom-icon-out-hover');

}).bind('click', function() {

   if ($(this).hasClass('zoom-icon-in'))
      $('.magazine-viewport').zoom('zoomIn');
   else if ($(this).hasClass('zoom-icon-out'))   
      $('.magazine-viewport').zoom('zoomOut');

});

$('#canvas').hide();


// Load the HTML4 version if there's not CSS transform

yepnope({
   test : Modernizr.csstransforms,
   yep: ['../../lib/turn.js'],
   nope: ['../../lib/turn.html4.min.js'],
   both: ['../../lib/zoom.min.js', 'js/magazine.js', 'css/magazine.css'],
   complete: loadApp
});

</script>
Can you provide the essential files for this problem as a zipped attachment and come out with main points of your problem area for me.
Image
where innovation meets technology
technically I have the flipbook working and at this link....http://www.marioncountynews.net/flipbook.php#page/1........My problem area actually is figuring out how to set the areas to allow the client to upload their images to the flipbook based on the code and how its laid out..
I need to be able to allow the client to add as many pages as they need to each flipbook as well from couch admin when they need to create another flipbook just click add new and do the same as well.....I have been studying repeatable regions again as I am still new to couch and dont think know if it would break the page layout of the html code...I am lost on the correct way to set the editable region for editing the pages
My problem area actually is figuring out how to set the areas to allow the client to upload their images to the flipbook based on the code and how its laid out..
I need to be able to allow the client to add as many pages as they need to each flipbook as well from couch admin when they need to create another flipbook just click add new and do the same as well.....I have been studying repeatable regions again as I am still new to couch and dont think know if it would break the page layout of the html code...I am lost on the correct way to set the editable region for editing the pages


Well from what I could gather, you aim to:
1. Have Multiple Flipbooks [color=#FF0000(this can be accomplished using a clonable template)[/color]

2. Each Flipbook should contain multiple pages (this can be achieved by defining a repeatable region with type=image with the clonable template, this is because you are going to upload each flipbook page individually)

Have you done any coding in couch till now???

Here is an example if you want to use and see. It shows the #2 that I have described above.
Flipbook http://genxcoders.in/test/ | Couch Login http://genxcoders.in/test/couch | username: admin and password: admin

let me know if any of these is helpful to your situation.

Regards,
Aashish
Image
where innovation meets technology
yes.I have actually coded a complete newspaper website using html and managing I feel so far to make it work with couch but not knowing yet all of the tags and core concepts..I had looked at the repeatable tag but didnt know if it would hold the 2 page layout in the code between the li classes.Thank you for the help and allowing me to see your test...I had studied your other posts about the flipbook.
Thank you for the help and allowing me to see your test...I had studied your other posts about the flipbook.


You are welcome. Also seeing your code I found this part the most interesting one (interesting coz this is where CouchCMS takes things a little beyond and allows PHP to be called in from within JS)...

Code: Select all

         // Events

         when: {
            turning: function(event, page, view) {
               
               var book = $(this),
               currentPage = book.turn('page'),
               pages = book.turn('pages');
         
               // Update the current URI

               Hash.go('page/' + page).update();

               // Show and hide navigation buttons

               disableControls(page);
               

               $('.thumbnails .page-'+currentPage).
                  parent().
                  removeClass('current');

               $('.thumbnails .page-'+page).
                  parent().
                  addClass('current');



            },

            turned: function(event, page, view) {

               disableControls(page);

               $(this).turn('center');

               if (page==1) {
                  $(this).turn('peel', 'br');
               }

            },

            missing: function (event, pages) {

               // Add pages that aren't in the magazine

               for (var i = 0; i < pages.length; i++)
                  addPage(pages[i], $(this));

            }
         }


where ever you have the "page", you need to show your repeatable region there...

happy working... Am here for next 1 hour if incase you need something that I could help you with...
Image
where innovation meets technology
much appreciative to you and thank you very much...Gives me an area to start with now..
Thanks... good to know i could help you channelize your efforts!!! Kudos!!! :D
Image
where innovation meets technology
I managed to easily get the thumbnails set in and realized that it doesnt touch the pages of flipbook.....I know you mentioned "pages" in js but im completely lost on as to how to add repeatable regions to the js files to add my own images
this is js called magazine.js from the flipbook:
Code: Select all
function addPage(page, book) {

   var id, pages = book.turn('pages');

   // Create a new element for this page
   var element = $('<div />', {});

   // Add the page to the flipbook
   if (book.turn('addPage', element, page)) {

      // Add the initial HTML
      // It will contain a loader indicator and a gradient
      element.html('<div class="gradient"></div><div class="loader"></div>');

      // Load the page
      loadPage(page, element);
   }

}

function loadPage(page, pageElement) {

   // Create an image element

   var img = $('<img />');

   img.mousedown(function(e) {
      e.preventDefault();
   });

   img.load(function() {
      
      // Set the size
      $(this).css({width: '100%', height: '100%'});

      // Add the image to the page after loaded

      $(this).appendTo(pageElement);

      // Remove the loader indicator
      
      pageElement.find('.loader').remove();
   });

   // Load the page

   img.attr('src', 'pages/' +  page + '.jpg');

   loadRegions(page, pageElement);

}

// Zoom in / Zoom out

function zoomTo(event) {

      setTimeout(function() {
         if ($('.magazine-viewport').data().regionClicked) {
            $('.magazine-viewport').data().regionClicked = false;
         } else {
            if ($('.magazine-viewport').zoom('value')==1) {
               $('.magazine-viewport').zoom('zoomIn', event);
            } else {
               $('.magazine-viewport').zoom('zoomOut');
            }
         }
      }, 1);

}



// Load regions

function loadRegions(page, element) {

   $.getJSON('pages/'+page+'-regions.json').
      done(function(data) {

         $.each(data, function(key, region) {
            addRegion(region, element);
         });
      });
}

// Add region

function addRegion(region, pageElement) {
   
   var reg = $('<div />', {'class': 'region  ' + region['class']}),
      options = $('.magazine').turn('options'),
      pageWidth = options.width/2,
      pageHeight = options.height;

   reg.css({
      top: Math.round(region.y/pageHeight*100)+'%',
      left: Math.round(region.x/pageWidth*100)+'%',
      width: Math.round(region.width/pageWidth*100)+'%',
      height: Math.round(region.height/pageHeight*100)+'%'
   }).attr('region-data', $.param(region.data||''));


   reg.appendTo(pageElement);
}

// Process click on a region

function regionClick(event) {

   var region = $(event.target);

   if (region.hasClass('region')) {

      $('.magazine-viewport').data().regionClicked = true;
      
      setTimeout(function() {
         $('.magazine-viewport').data().regionClicked = false;
      }, 100);
      
      var regionType = $.trim(region.attr('class').replace('region', ''));

      return processRegion(region, regionType);

   }

}

// Process the data of every region

function processRegion(region, regionType) {

   data = decodeParams(region.attr('region-data'));

   switch (regionType) {
      case 'link' :

         window.open(data.url);

      break;
      case 'zoom' :

         var regionOffset = region.offset(),
            viewportOffset = $('.magazine-viewport').offset(),
            pos = {
               x: regionOffset.left-viewportOffset.left,
               y: regionOffset.top-viewportOffset.top
            };

         $('.magazine-viewport').zoom('zoomIn', pos);

      break;
      case 'to-page' :

         $('.magazine').turn('page', data.page);

      break;
   }

}

// Load large page

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

   img.load(function() {

      var prevImg = pageElement.find('img');
      $(this).css({width: '100%', height: '100%'});
      $(this).appendTo(pageElement);
      prevImg.remove();
      
   });

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

// Load small page

function loadSmallPage(page, pageElement) {
   
   var img = pageElement.find('img');

   img.css({width: '100%', height: '100%'});

   img.unbind('load');
   // Loadnew page

   img.attr('src', 'pages/' +  page + '.jpg');
}

// http://code.google.com/p/chromium/issues/detail?id=128488

function isChrome() {

   return navigator.userAgent.indexOf('Chrome')!=-1;

}

function disableControls(page) {
      if (page==1)
         $('.previous-button').hide();
      else
         $('.previous-button').show();
               
      if (page==$('.magazine').turn('pages'))
         $('.next-button').hide();
      else
         $('.next-button').show();
}

// Set the width and height for the viewport

function resizeViewport() {

   var width = $(window).width(),
      height = $(window).height(),
      options = $('.magazine').turn('options');

   $('.magazine').removeClass('animated');

   $('.magazine-viewport').css({
      width: width,
      height: height
   }).
   zoom('resize');


   if ($('.magazine').turn('zoom')==1) {
      var bound = calculateBound({
         width: options.width,
         height: options.height,
         boundWidth: Math.min(options.width, width),
         boundHeight: Math.min(options.height, height)
      });

      if (bound.width%2!==0)
         bound.width-=1;

         
      if (bound.width!=$('.magazine').width() || bound.height!=$('.magazine').height()) {

         $('.magazine').turn('size', bound.width, bound.height);

         if ($('.magazine').turn('page')==1)
            $('.magazine').turn('peel', 'br');

         $('.next-button').css({height: bound.height, backgroundPosition: '-38px '+(bound.height/2-32/2)+'px'});
         $('.previous-button').css({height: bound.height, backgroundPosition: '-4px '+(bound.height/2-32/2)+'px'});
      }

      $('.magazine').css({top: -bound.height/2, left: -bound.width/2});
   }

   var magazineOffset = $('.magazine').offset(),
      boundH = height - magazineOffset.top - $('.magazine').height(),
      marginTop = (boundH - $('.thumbnails > div').height()) / 2;

   if (marginTop<0) {
      $('.thumbnails').css({height:1});
   } else {
      $('.thumbnails').css({height: boundH});
      $('.thumbnails > div').css({marginTop: marginTop});
   }

   if (magazineOffset.top<$('.made').height())
      $('.made').hide();
   else
      $('.made').show();

   $('.magazine').addClass('animated');
   
}


// Number of views in a flipbook

function numberOfViews(book) {
   return book.turn('pages') / 2 + 1;
}

// Current view in a flipbook

function getViewNumber(book, page) {
   return parseInt((page || book.turn('page'))/2 + 1, 10);
}

function moveBar(yes) {
   if (Modernizr && Modernizr.csstransforms) {
      $('#slider .ui-slider-handle').css({zIndex: yes ? -1 : 10000});
   }
}

function setPreview(view) {

   var previewWidth = 112,
      previewHeight = 73,
      previewSrc = 'pages/preview.jpg',
      preview = $(_thumbPreview.children(':first')),
      numPages = (view==1 || view==$('#slider').slider('option', 'max')) ? 1 : 2,
      width = (numPages==1) ? previewWidth/2 : previewWidth;

   _thumbPreview.
      addClass('no-transition').
      css({width: width + 15,
         height: previewHeight + 15,
         top: -previewHeight - 30,
         left: ($($('#slider').children(':first')).width() - width - 15)/2
      });

   preview.css({
      width: width,
      height: previewHeight
   });

   if (preview.css('background-image')==='' ||
      preview.css('background-image')=='none') {

      preview.css({backgroundImage: 'url(' + previewSrc + ')'});

      setTimeout(function(){
         _thumbPreview.removeClass('no-transition');
      }, 0);

   }

   preview.css({backgroundPosition:
      '0px -'+((view-1)*previewHeight)+'px'
   });
}

// Width of the flipbook when zoomed in

function largeMagazineWidth() {
   
   return 2214;

}

// decode URL Parameters

function decodeParams(data) {

   var parts = data.split('&'), d, obj = {};

   for (var i =0; i<parts.length; i++) {
      d = parts[i].split('=');
      obj[decodeURIComponent(d[0])] = decodeURIComponent(d[1]);
   }

   return obj;
}

// Calculate the width and height of a square within another square

function calculateBound(d) {
   
   var bound = {width: d.width, height: d.height};

   if (bound.width>d.boundWidth || bound.height>d.boundHeight) {
      
      var rel = bound.width/bound.height;

      if (d.boundWidth/rel>d.boundHeight && d.boundHeight*rel<=d.boundWidth) {
         
         bound.width = Math.round(d.boundHeight*rel);
         bound.height = d.boundHeight;

      } else {
         
         bound.width = d.boundWidth;
         bound.height = Math.round(d.boundWidth/rel);
      
      }
   }
      
   return bound;
}



this is my html code that had thumbnails as well as js:
Code: Select all
<!-- Thumbnails -->
<div class="thumbnails">
   <div>
      <ul>
         <li class="i">
            
                         <img src="<cms:show frontcover_image />" width="76" height="100" class="page-1">
            <span>1</span>
         
                               </li>
         <li class="d">
         <cms:show_repeatable 'doublepage_image'>   
                     <img src="<cms:show doublepage_image />" width="76" height="100" class="page-2">
                     <span>2-3</span>
                  </cms:show_repeatable>
                                </li>
         
         <li class="i">
            <img src="<cms:show backcover_image />" width="76" height="100" class="page-12">
            <span>12</span>
         
                          </li>
      <ul>
   <div>   
</div>
</div>

<script type="text/javascript">

function loadApp() {

   $('#canvas').fadeIn(1000);

   var flipbook = $('.magazine');

   // Check if the CSS was already loaded
   
   if (flipbook.width()==0 || flipbook.height()==0) {
      setTimeout(loadApp, 10);
      return;
   }
   
   // Create the flipbook

   flipbook.turn({
         
         // Magazine width

         width: 922,

         // Magazine height

         height: 600,

         // Duration in millisecond

         duration: 1000,

         // Hardware acceleration

         acceleration: !isChrome(),

         // Enables gradients

         gradients: true,
         
         // Auto center this flipbook

         autoCenter: true,

         // Elevation from the edge of the flipbook when turning a page

         elevation: 50,

         // The number of pages

         pages: 12,

         // Events

         when: {
            turning: function(event, page, view) {
               
               var book = $(this),
               currentPage = book.turn('page'),
               pages = book.turn('pages');
         
               // Update the current URI

               Hash.go('page/' + page).update();

               // Show and hide navigation buttons

               disableControls(page);
               

               $('.thumbnails .page-'+currentPage).
                  parent().
                  removeClass('current');

               $('.thumbnails .page-'+page).
                  parent().
                  addClass('current');



            },

            turned: function(event, page, view) {

               disableControls(page);

               $(this).turn('center');

               if (page==1) {
                  $(this).turn('peel', 'br');
               }

            },

            missing: function (event, pages) {

               // Add pages that aren't in the magazine

               for (var i = 0; i < pages.length; i++)
                  addPage(pages[i], $(this));

            }
         }

   });

   // Zoom.js

   $('.magazine-viewport').zoom({
      flipbook: $('.magazine'),

      max: function() {
         
         return largeMagazineWidth()/$('.magazine').width();

      },

      when: {

         swipeLeft: function() {

            $(this).zoom('flipbook').turn('next');

         },

         swipeRight: function() {
            
            $(this).zoom('flipbook').turn('previous');

         },

         resize: function(event, scale, page, pageElement) {

            if (scale==1)
               loadSmallPage(page, pageElement);
            else
               loadLargePage(page, pageElement);

         },

         zoomIn: function () {

            $('.thumbnails').hide();
            $('.made').hide();
            $('.magazine').removeClass('animated').addClass('zoom-in');
            $('.zoom-icon').removeClass('zoom-icon-in').addClass('zoom-icon-out');
            
            if (!window.escTip && !$.isTouch) {
               escTip = true;

               $('<div />', {'class': 'exit-message'}).
                  html('<div>Press ESC to exit</div>').
                     appendTo($('body')).
                     delay(2000).
                     animate({opacity:0}, 500, function() {
                        $(this).remove();
                     });
            }
         },

         zoomOut: function () {

            $('.exit-message').hide();
            $('.thumbnails').fadeIn();
            $('.made').fadeIn();
            $('.zoom-icon').removeClass('zoom-icon-out').addClass('zoom-icon-in');

            setTimeout(function(){
               $('.magazine').addClass('animated').removeClass('zoom-in');
               resizeViewport();
            }, 0);

         }
      }
   });

   // Zoom event

   if ($.isTouch)
      $('.magazine-viewport').bind('zoom.doubleTap', zoomTo);
   else
      $('.magazine-viewport').bind('zoom.tap', zoomTo);


   // Using arrow keys to turn the page

   $(document).keydown(function(e){

      var previous = 37, next = 39, esc = 27;

      switch (e.keyCode) {
         case previous:

            // left arrow
            $('.magazine').turn('previous');
            e.preventDefault();

         break;
         case next:

            //right arrow
            $('.magazine').turn('next');
            e.preventDefault();

         break;
         case esc:
            
            $('.magazine-viewport').zoom('zoomOut');   
            e.preventDefault();

         break;
      }
   });

   // URIs - Format #/page/1

   Hash.on('^page\/([0-9]*)$', {
      yep: function(path, parts) {
         var page = parts[1];

         if (page!==undefined) {
            if ($('.magazine').turn('is'))
               $('.magazine').turn('page', page);
         }

      },
      nop: function(path) {

         if ($('.magazine').turn('is'))
            $('.magazine').turn('page', 1);
      }
   });


   $(window).resize(function() {
      resizeViewport();
   }).bind('orientationchange', function() {
      resizeViewport();
   });

   // Events for thumbnails

   $('.thumbnails').click(function(event) {
      
      var page;

      if (event.target && (page=/page-([0-9]+)/.exec($(event.target).attr('class'))) ) {
      
         $('.magazine').turn('page', page[1]);
      }
   });

   $('.thumbnails li').
      bind($.mouseEvents.over, function() {
         
         $(this).addClass('thumb-hover');

      }).bind($.mouseEvents.out, function() {
         
         $(this).removeClass('thumb-hover');

      });

   if ($.isTouch) {
   
      $('.thumbnails').
         addClass('thumbanils-touch').
         bind($.mouseEvents.move, function(event) {
            event.preventDefault();
         });

   } else {

      $('.thumbnails ul').mouseover(function() {

         $('.thumbnails').addClass('thumbnails-hover');

      }).mousedown(function() {

         return false;

      }).mouseout(function() {

         $('.thumbnails').removeClass('thumbnails-hover');

      });

   }


   // Regions

   if ($.isTouch) {
      $('.magazine').bind('touchstart', regionClick);
   } else {
      $('.magazine').click(regionClick);
   }

   // Events for the next button

   $('.next-button').bind($.mouseEvents.over, function() {
      
      $(this).addClass('next-button-hover');

   }).bind($.mouseEvents.out, function() {
      
      $(this).removeClass('next-button-hover');

   }).bind($.mouseEvents.down, function() {
      
      $(this).addClass('next-button-down');

   }).bind($.mouseEvents.up, function() {
      
      $(this).removeClass('next-button-down');

   }).click(function() {
      
      $('.magazine').turn('next');

   });

   // Events for the next button
   
   $('.previous-button').bind($.mouseEvents.over, function() {
      
      $(this).addClass('previous-button-hover');

   }).bind($.mouseEvents.out, function() {
      
      $(this).removeClass('previous-button-hover');

   }).bind($.mouseEvents.down, function() {
      
      $(this).addClass('previous-button-down');

   }).bind($.mouseEvents.up, function() {
      
      $(this).removeClass('previous-button-down');

   }).click(function() {
      
      $('.magazine').turn('previous');

   });


   resizeViewport();

   $('.magazine').addClass('animated');

}

// Zoom icon

$('.zoom-icon').bind('mouseover', function() {
   
   if ($(this).hasClass('zoom-icon-in'))
      $(this).addClass('zoom-icon-in-hover');

   if ($(this).hasClass('zoom-icon-out'))
      $(this).addClass('zoom-icon-out-hover');

}).bind('mouseout', function() {
   
    if ($(this).hasClass('zoom-icon-in'))
      $(this).removeClass('zoom-icon-in-hover');
   
   if ($(this).hasClass('zoom-icon-out'))
      $(this).removeClass('zoom-icon-out-hover');

}).bind('click', function() {

   if ($(this).hasClass('zoom-icon-in'))
      $('.magazine-viewport').zoom('zoomIn');
   else if ($(this).hasClass('zoom-icon-out'))   
      $('.magazine-viewport').zoom('zoomOut');

});

$('#canvas').hide();


// Load the HTML4 version if there's not CSS transform

yepnope({
   test : Modernizr.csstransforms,
   yep: ['../../lib/turn.js'],
   nope: ['../../lib/turn.html4.min.js'],
   both: ['../../lib/zoom.min.js', 'js/magazine.js', 'css/magazine.css'],
   complete: loadApp
});

</script>

if anyone could help me out on this i greatly appreciate it..thank you
ok skip the turn.js it seems that I'd have to add 3 dif size images to the pic folder and thats too much..........I downloaded jquery booklet and it seems less complicated...However how can I use couch to add page numbers as I add pages to the book....For instance....the book has 12 pages in it now but as I add pages can I use couch to automatically add page numbers?
Code: Select all
<h1>Specials Section</h1>
   </header>
   <section>
       <div class="book_wrapper" >
               <div id="mybook">
           <div title="first page">
               <h3><img src="images/large/1-1.jpg" alt="" /></h3>
           </div>
           <div title="second page">
               <h3>Page 2</h3>
           </div>
           <div title="third page">
               <h3>Page 3</h3>
           </div>
           <div title="fourth page">
               <h3>Page 4</h3>
           </div>
           <div title="fifth page">
               <h3>Page 5</h3>
           </div>
           <div title="sixth page">
               <h3>Page 6</h3>
           </div>
           <div title="seventh page">
               <h3>Page 7</h3>
           </div>
           <div title="eighth page">
               <h3>Page 8</h3>
           </div>
       </div>
11 posts Page 1 of 2