title: Toggle single page and multiple page in pdfviewer plugin
body: <p>I am messing around real3d-flipbook to include a new button where the user can decide whether he wants to view the pdf as 2 pages like a book or single page.</p>
  <p>I have managed to do the code but when I change the singlePageMode on click of the button, a particular method is being called multiple times resulting in <code>Uncaught RangeError: Maximum call stack size exceeded </code>
  This is where I am changing the singlePageMode from <code>flipbook.min.js</code></p>
  <pre><code>togglePage:function(){
          var e=this.options;
          e.singlePageMode=!e.singlePageMode;
          this.toggleIcon(this.btnPage,e.singlePageMode)                                                      
  },
  </code></pre>
  <p>and this is the function in <code>flipbook.book3.min.js</code> that is being called multiple times when I change the singlePageMode:</p>
  <pre><code>FLIPBOOK.Book3.prototype.updateBookPosition=function(){ 
      if(this.options.singlePageMode)
          return this.setWrapperW(this.pageWidth),this.$wrapper.width(this.pageWidth),this.scroll&amp;&amp;this.scroll.refresh(),this.view=1,void this.focusRight();1==this.view?this.setWrapperW(this.pageWidth):this.setWrapperW(2*this.pageWidth),this.scroll&amp;&amp;this.scroll.refresh(),2==this.view?this.isCover()?this.focusRight():this.isBackCover()&amp;&amp;this.options.cover?this.focusLeft():this.focusBoth():1==this.view&amp;&amp;(this.isCover()?this.focusRight():this.isBackCover()&amp;&amp;this.focusLeft())},
  </code></pre>
  <p>I have tried to recreate the book like this  which results in another book under the previous one with no idea how to remove the first one:</p>
  <pre><code>togglePage:function(){
      var e=this.options;
      e.singlePageMode=!e.singlePageMode;
      this.loadScript(FLIPBOOK.flipbookBook3Src,this.createBook),
      console.log(this);
      this.toggleIcon(this.btnPage,e.singlePageMode)                                                      
  },
  </code></pre>
  <p>This eliminates the problem with calling updateBookPosition multiple times but is showing 2 books - the original above the new one. Any idea how I eliminate the previous one or update it without hitches?</p>