Keine Beschreibung

detach.html 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Holder Detached DOM Testing</title>
  5. <meta charset="utf-8">
  6. <style>
  7. body {background: #fff; font-family:Arial,sans-serif;margin:0 auto;min-width:1080px}
  8. .thumb {width:300px;height:250px;margin:25px;float:left}
  9. .thumb img, .thumb .holderjs, .thumb object {display:block;margin:0 auto}
  10. .thumb .caption {padding:10px;text-align:center;margin-top:10px}
  11. button {clear: both;display:block;margin:10px;font-size:1.2em;}
  12. </style>
  13. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  14. <script src="../holder.js"></script>
  15. <script>
  16. Holder.run();
  17. $(function () {
  18. var cloneThumb = $('.thumb:first').clone();
  19. Holder.run();
  20. $("#replaceBtn").on('click', function (e) {
  21. $('body').remove();
  22. var newBody = $('<body />');
  23. newBody.append(cloneThumb);
  24. newBody.appendTo($('html'));
  25. Holder.run();
  26. });
  27. });
  28. </script>
  29. </head>
  30. <body>
  31. <button id="replaceBtn">Replace body</button>
  32. <div class="thumb">
  33. <img data-src="holder.js/300x200">
  34. <div class="caption">
  35. Plain placeholder
  36. </div>
  37. </div>
  38. </body>
  39. </html>