nirsh
(Nir Shaked)
August 24, 2019, 1:42pm
1
Hi everyone!
I wanna add to my horizontal scrolling an option to use drag as well. I tried to add a piece of java script (which I’ve already used in webflow once and worked fine) to my website and it’s not working for some reason…
when I check the console it says:
jQuery.Deferred exception: Cannot set property ‘_persistentUIState’ of undefined TypeError: Cannot set property ‘_persistentUIState’ of undefined
does anyone know what am I doing wrong?
read only:
https://preview.webflow.com/preview/69-for-israel?utm_medium=preview_link&utm_source=designer&utm_content=69-for-israel&preview=2f3583615dac108b8edf7849e0b8c546&mode=preview
thanks a lot !
Moderator Edit — published link: https://69-for-israel.webflow.io/
nirsh
(Nir Shaked)
August 25, 2019, 6:01am
3
hi Siton!
thanks for the reply, here’s URL
https://69-for-israel.webflow.io/
and the script goes like this:
(I followed a youtube tutorial, cant find it now)
const slider = document.querySelector(‘.gallery’);
let isDown = false;
let startX;
let scrollLeft;
slider.addEventListener(‘mousedown’, (e) => {
isDown = true;
slider.classList.add(‘active’);
startX = e.pageX - slider.offsetLeft;
scrollLeft = slider.scrollLeft;
});
slider.addEventListener(‘mouseleave’, () => {
isDown = false;
slider.classList.remove(‘active’);
});
slider.addEventListener(‘mouseup’, () => {
isDown = false;
slider.classList.remove(‘active’);
});
slider.addEventListener(‘mousemove’, (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider.offsetLeft;
const walk = (x - startX)*2;
slider.scrollLeft = scrollLeft - walk;
});
document.getElementsByClassName(‘animage’).ondragstart = function() { return false; };
Next time wrap you code.
I don’t get any error (But no effect). Add the tutorial link.
This is not bug (Webflow issue) - but custom code issue.
rtong
September 30, 2019, 9:34pm
5
Where is that toolbar to click that button? Don’t see it in the Designer.
system
(system)
Closed
November 30, 2019, 6:34pm
6
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.