diff --git a/htdocs/wp-content/themes/lawcarta/assets/js/sliderScript.js b/htdocs/wp-content/themes/lawcarta/assets/js/sliderScript.js new file mode 100644 index 0000000..e5e0e07 --- /dev/null +++ b/htdocs/wp-content/themes/lawcarta/assets/js/sliderScript.js @@ -0,0 +1,62 @@ +var slider; +var sliderOptions = { + perPage: 3, + gap: 30 +}; + +function mountSlider(){ + slider = new Splide( '.splide', { + type: 'loop', + perPage: sliderOptions.perPage, + perMove: 1, + rewind : true, + pagination: false, + gap: sliderOptions.gap + } ).mount(); +} + +function destroySlider(){ + slider.destroy(completely = true); +} + +function resizeWindow(){ + var sliderSize = document.querySelector('.slider-size').dataset.sliderSize; + var windowSize = document.body.clientWidth; + sliderOptions = null; + if ( windowSize > 1000 && sliderSize != 'md' ) { + sliderOptions = { + perPage: 3, + gap: 30 + } + document.querySelector('.slider-size').dataset.sliderSize = 'md'; + } + if ( ( windowSize > 768 && windowSize <= 1024 ) && sliderSize != 'sm') { + sliderOptions = { + perPage: 2, + gap: 10 + } + document.querySelector('.slider-size').dataset.sliderSize = 'sm'; + } + if ( windowSize <= 768 && sliderSize != 'xs') { + sliderOptions = { + perPage: 1, + gap: 0 + } + document.querySelector('.slider-size').dataset.sliderSize = 'xs'; + } + if (sliderOptions) { + destroySlider(); + mountSlider(); + } +} + +mountSlider(); +resizeWindow(); +window.onresize = resizeWindow; + +function scrollToCalendar() { + event.preventDefault(); + var scrollContCoords = document.querySelector('.pc-calendar-desktop').getBoundingClientRect().top; + var scrollCoords = window.pageYOffset + scrollContCoords + 15; + window.scrollTo(0, scrollCoords); +} \ No newline at end of file diff --git a/htdocs/wp-content/themes/lawcarta/footer.php b/htdocs/wp-content/themes/lawcarta/footer.php index 3edb5d5..5cb2146 100644 --- a/htdocs/wp-content/themes/lawcarta/footer.php +++ b/htdocs/wp-content/themes/lawcarta/footer.php @@ -83,6 +83,7 @@ require_once 'inc/walker-nav-menu.php'; + diff --git a/htdocs/wp-content/themes/livecarta/footer.php b/htdocs/wp-content/themes/livecarta/footer.php index 4567639..77d3655 100644 --- a/htdocs/wp-content/themes/livecarta/footer.php +++ b/htdocs/wp-content/themes/livecarta/footer.php @@ -77,5 +77,6 @@ + \ No newline at end of file