default.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. require_once '../parts.php';
  3. require_once '../settings.php';
  4. $settings = get_settings();
  5. ?>
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9. <meta charset="UTF-8">
  10. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  11. <title>Default</title>
  12. <link rel="stylesheet" href="../../../../../dist/css/themes/splide-<?php echo $settings['theme'] ?>.min.css">
  13. <link rel="stylesheet" href="../../assets/css/styles.css">
  14. <script type="text/javascript" src="../../../../../dist/js/splide.js"></script>
  15. <!-- https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/js/splide.min.js-->
  16. <script>
  17. document.addEventListener( 'DOMContentLoaded', function () {
  18. var splide = new Splide( '#splide01', {
  19. width: 800,
  20. // type : 'loop',
  21. perPage: 3,
  22. // perMove: 3,
  23. // rewind: true,
  24. // rewindByDrag: true,
  25. // padding: '3rem',
  26. // updateOnMove: true,
  27. // direction: 'ltr',
  28. // height: undefined,
  29. // gap: '30%',
  30. // paginationDirection: 'ttb',
  31. // rewindSpeed: 2000,
  32. // role: '',
  33. label: 'Changed Label',
  34. focus: 0,
  35. omitEnd: true,
  36. breakpoints: {
  37. 1200: {
  38. start: 4,
  39. // padding: 5,
  40. },
  41. 1000: {
  42. label: 'The destroyed carousel',
  43. destroy: true,
  44. },
  45. },
  46. classes: {
  47. arrows: 'splide__arrows custom-arrows',
  48. pagination: 'splide__pagination custom-pagination',
  49. },
  50. } );
  51. // splide.on( 'destroy', function () {
  52. // console.log( 'destroy' );
  53. // } );
  54. //
  55. // splide.on( 'moved', function ( index, prev, dest ) {
  56. // console.log( 'moved', index, prev, dest );
  57. // } );
  58. //
  59. // splide.on( 'visible', Slide => {
  60. // console.log( 'visible', Slide );
  61. // } );
  62. //
  63. // splide.on( 'hidden', Slide => {
  64. // console.log( 'hidden', Slide );
  65. // } );
  66. //
  67. // splide.on( 'click', function () {
  68. // console.log( 'click' );
  69. // } );
  70. //
  71. // splide.on( 'shifted', function () {
  72. // console.log( 'shifted' );
  73. // } );
  74. //
  75. // splide.on( 'drag', function () {
  76. // console.log( 'drag' );
  77. // } );
  78. //
  79. // splide.on( 'dragged', function () {
  80. // console.log( 'dragged' );
  81. // } );
  82. splide.mount();
  83. const pre = document.querySelector( 'pre' );
  84. document.querySelector( '#jump' ).addEventListener( 'click', () => {
  85. splide.Components.Controller.jump( '+2' )
  86. } );
  87. // Array.from( document.getElementsByTagName( 'button' ) ).forEach( button => {
  88. // button.addEventListener( 'click', function () {
  89. // alert( 'click' );
  90. // } );
  91. // } );
  92. // console.log = ( ...args ) => {
  93. // pre.textContent = args.join( ' ' ) + '\n' + pre.textContent;
  94. // };
  95. } );
  96. </script>
  97. <style>
  98. body {
  99. margin: 50em 0;
  100. }
  101. </style>
  102. </head>
  103. <body>
  104. <?php render( 'splide01', 10 ); ?>
  105. <button id="jump">
  106. jump
  107. </button>
  108. <div>
  109. <div style="margin-right: 1rem">a</div>
  110. </div>
  111. <pre></pre>
  112. </body>
  113. </html>