playground.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ---
  2. layout: default
  3. title: Interactive Playground
  4. permalink: /playground/
  5. redirect_from:
  6. - /examples/
  7. pens:
  8. - title: Autosave
  9. slug: RRYBEP
  10. - title: Class vs Inline Style
  11. slug: jAvpQL
  12. - title: Form Submit
  13. slug: kXRjQJ
  14. - title: Snow Toolbar Tooltips
  15. slug: ozYEro
  16. - title: Autogrow Height
  17. slug: dOqrVm
  18. - title: Custom Fonts
  19. slug: gLBYam
  20. - title: Quill Playground
  21. slug: KzZqZx
  22. ---
  23. <div class="container">
  24. <div id="playground-container">
  25. <h1>Interactive Playground</h1>
  26. <iframe src="//codepen.io/anon/embed/{{page.pens.last.slug}}/?height=500&amp;editable=true&amp;embed-version=2&amp;theme-id=23269&amp;default-tab=js%2Cresult&amp;user=anon" height="500" allowfullscreen></iframe>
  27. </div>
  28. <div id="gallery-container">
  29. {% for pen in page.pens %}
  30. <div class="four columns{% if forloop.last %} selected-pen{% endif %}">
  31. <a href="/playground/#{{ pen.title | slugify }}" title="{{ pen.title }}" data-id="{{pen.slug}}">
  32. <img alt="{{pen.title}} Screenshot" src="https://codepen.io/quill/pen/{{pen.slug}}/image/small.png">
  33. <span class="pen-label">{{pen.title}}</span>
  34. </a>
  35. </div>
  36. {% endfor %}
  37. </div>
  38. {% include open-source.html %}
  39. </div>
  40. <!-- script -->
  41. <script>
  42. $(document).ready(function() {
  43. $('#gallery-container a').click(function(e) {
  44. switchSelected(this);
  45. });
  46. if (window.location.hash) {
  47. var anchor = $('#gallery-container a[href="/playground/' + window.location.hash + '"]');
  48. if (anchor.length > 0) {
  49. switchSelected(anchor);
  50. }
  51. }
  52. function switchSelected(a) {
  53. $('#gallery-container .selected-pen').removeClass('selected-pen');
  54. $(a).parent().addClass('selected-pen');
  55. var slug = $(a).attr('data-id');
  56. var src = $('#playground-container iframe').attr('src').split('/');
  57. src.splice(-2, 1, slug);
  58. $('#playground-container iframe').attr('src', src.join('/'));
  59. }
  60. });
  61. </script>
  62. <!-- script -->