32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
window.addEventListener('load', () => {
|
|
blockarrow();
|
|
})
|
|
window.addEventListener('unload', () => {
|
|
blockarrow();
|
|
})
|
|
function blockarrow(){
|
|
|
|
|
|
var liczba=0;
|
|
document.querySelector('.wydarzenia .owl-prev').style.setProperty('pointer-events','none');
|
|
var iloscdivow=Math.round(new Number(document.querySelectorAll('.wydarzenia .owl-item').length/2-1));
|
|
|
|
document.querySelector('.wydarzenia .owl-prev ').addEventListener('click', () => {
|
|
liczba--;
|
|
|
|
if(liczba < 1){
|
|
document.querySelector('.wydarzenia .owl-prev').style.setProperty('pointer-events','none');
|
|
}
|
|
document.querySelector('.wydarzenia .owl-next').style.removeProperty('pointer-events');
|
|
})
|
|
document.querySelector('.wydarzenia .owl-next ').addEventListener('click', () => {
|
|
liczba++;
|
|
|
|
if(liczba==iloscdivow){
|
|
console.log('liczby sa rowne');
|
|
document.querySelector('.wydarzenia .owl-next').style.setProperty('pointer-events','none');
|
|
}
|
|
document.querySelector('.wydarzenia .owl-prev').style.removeProperty('pointer-events');
|
|
|
|
})
|
|
} |