Sha256: feee4afd3d80fe3900b37b279abd85dbb208fa4e52b14347a5ddedd5d6496ff4

Contents?: true

Size: 1.62 KB

Versions: 43

Compression:

Stored size: 1.62 KB

Contents

import './bulma-carousel/js/bulma-carousel.js';
// Initialize all elements with carousel class.
const carousels = bulmaCarousel.attach('.carousel',{
    slidesToScroll: 1,
    slidesToShow: 1,
    icons: {
        'previous': `<img src="../assets/img/arrow-left.png"></img>`,
        'next': `<img src="../assets/img/arrow-left.png" style="transform: rotate(180deg);"></img>`}
});

var scrollUpArrow= document.getElementById("scroll-up");
var scrollDownArrow= document.getElementById("scroll-down");
var scrollStep=10,
	scrollTimer=null

scrollUpArrow.addEventListener("mouseenter", function(evt){
    scroll(-scrollStep)
})
scrollUpArrow.addEventListener("mouseleave", function(evt){
    if(scrollTimer!=null)clearTimeout(scrollTimer);
})
scrollDownArrow.addEventListener("mouseleave", function(evt){
    if(scrollTimer!=null)clearTimeout(scrollTimer);
})
scrollDownArrow.addEventListener("mouseenter", function(evt){
    scroll(scrollStep)
})
function scroll(yDisplacement){
    if(scrollTimer!=null)clearTimeout(scrollTimer);

  scrollTimer = setTimeout(function(){
      window.scroll({
        top:window.scrollY+yDisplacement,
      left:0,
      behavior: 'smooth'
      })  
      scroll(yDisplacement)
  }, 50);
}

window.onscroll = function(ev) {
    if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
        scrollDownArrow.classList.add("is-hidden");
    }else if(window.pageYOffset === 0){
        scrollUpArrow.classList.add("is-hidden");
    }else{
        scrollDownArrow.classList.remove("is-hidden"); 
        scrollUpArrow.classList.remove("is-hidden"); 
    }
};

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
intia-theme-0.1.50 assets/js/main.js
intia-theme-0.1.49 assets/js/main.js
intia-theme-0.1.48 assets/js/main.js
intia-theme-0.1.47 assets/js/main.js
intia-theme-0.1.46 assets/js/main.js
intia-theme-0.1.45 assets/js/main.js
intia-theme-0.1.44 assets/js/main.js
intia-theme-0.1.43 assets/js/main.js
intia-theme-0.1.42 assets/js/main.js
intia-theme-0.1.41 assets/js/main.js
intia-theme-0.1.40 assets/js/main.js
intia-theme-0.1.39 assets/js/main.js
intia-theme-0.1.38 assets/js/main.js
intia-theme-0.1.37 assets/js/main.js
intia-theme-0.1.36 assets/js/main.js
intia-theme-0.1.35 assets/js/main.js
intia-theme-0.1.34 assets/js/main.js
intia-theme-0.1.33 assets/js/main.js
intia-theme-0.1.32 assets/js/main.js
intia-theme-0.1.31 assets/js/main.js