mercredi 18 septembre 2019

How to display flipbook made using turn.js as an overlay popup

I have made a flipbook using turn.js(The basic sample). It is working completely fine when viewed in a browser. But I want to display it on my laravel website as an overlay popup that appears as soon as the page is loaded.

When I tried, only the background colour got changed and I got a "close" button in the popup. The flipbook was not visible. I am new to jquery. I have tried to club two different codes (one for flipbook and one for overlay popup). I couldn't figure out what should be done.

<head>

<style type="text/css">
    #overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: #000;
      filter:alpha(opacity=70);
      -moz-opacity:0.7;
      -khtml-opacity: 0.7;
      opacity: 0.7;
      z-index: 100;
      display: none;
    }
   .popup{
     width: 100%;
     margin: 0 auto;
     display: none;
     position: fixed;
     z-index: 101;
    }
   .cnt223{
     min-width: 600px;
     width: 600px;
     min-height: 150px;
     margin: 100px auto;
     background: #f3f3f3;
     position: relative;
     z-index: 103;
     padding: 15px 35px;
     border-radius: 5px;
     box-shadow: 0 2px 5px #000;
    }
   .cnt223 .x{
     float: right;
     height: 35px;
     left: 22px;
     position: relative;
     top: -25px;
     width: 34px;
    }

   .cnt223 .x:hover{
     cursor: pointer;
   }
</style>

<script type='text/javascript'>
  $(function(){
    var overlay = $('<div id="overlay"></div>');
    overlay.show();
    overlay.appendTo(document.body);
    $('.popup').show();
    $('.close').click(function(){
      $('.popup').hide();
      overlay.appendTo(document.body).remove();
      return false;
    });

    $('.x').click(function(){
      $('.popup').hide();
      overlay.appendTo(document.body).remove();
      return false;
    });
  });
</script>

<script type="text/javascript">

  function loadApp() {
    $('.flipbook').turn({
      width:922,
      height:600,
      elevation: 50,
      gradients: true,
      autoCenter: true
       });
   }
   yepnope({
        test : Modernizr.csstransforms,
         yep: ['../../lib/turn.js'],
          nope: ['../../lib/turn.html4.min.js'],
           both: ['css/basic.css'],
            complete: loadApp
  });

</script>
</head>

<body>
<div class='popup'>
  <div class='cnt223'>
    <div class="flipbook-viewport">
        <div class="container">
            <div class="flipbook">
                <div style="background-image:url(pages/1.jpeg)"></div>
                <div style="background-image:url(pages/2.png)"></div>
                <div style="background-image:url(pages/3.png)"></div>
                <div style="background-image:url(pages/4.png)"></div>
            </div>
        </div>
    </div>

  </div>
</div>
</body>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire