I have a long light box and it scroll very rough on mobile. How to make it smooth like a page scrolling.I cant use the normal page instead of light box so please give me some solution.
My Lightbox ID is lightbox1
please right the full code because i don’t know about coding
I got this code from https://codepen.io/JTParrett/pen/BkDie and paste it exaclty but it is not working please edit this code if it is right or provide me new codes.
$.fn.moveIt = function(){
var $window = $(window);
var instances = ;
$(this).each(function(){
instances.push(new moveItItem($(this)));
});
window.addEventListener(‘scroll’, function(){
var scrollTop = $window.scrollTop();
instances.forEach(function(inst){
inst.update(scrollTop);
});
}, {passive: true});
}
var moveItItem = function(el){
this.el = $(el);
this.speed = parseInt(this.el.attr(‘data-scroll-speed’));
};
moveItItem.prototype.update = function(scrollTop){
this.el.css(‘transform’, ‘translateY(’ + -(scrollTop / this.speed) + ‘px)’);
};
// Initialization
$(function(){
$(‘[data-scroll-speed]’).moveIt();
});
Hi Rishabh,
The code that you have won’t work with Wix Code.
WixCode understands all of Javascript, except for anything that accesses the DOM.
This keeps the user from inadvertently “breaking” something. I myself tried to hack things from the code, from an iFrame, and in my dreams, but WixCode wasn’t having any of it.
Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w.
One small exception is the $w.HtmlComponent (which is based on an iFrame). This element was designed to contain vanilla HTML and it works just fine. You just can’t try to trick it by using parent, window, top, etc.
The Wix Lightbox is manipulated solely through the Wix Editor and the wix-window.lightbox API .
Have fun,
Yisrael
can you please provide the code to increase the scroll smoothness because it scroll very rough
My light box id is lightbox1
I tried a Lightbox on my mobile device and it scrolls fine. This is not really a code issue.
Note that this forum is dedicated to Wix Code. For questions regarding Lightbox, please contact Wix support team , as they will be able to offer better assistance regarding this issue.
Ok thanks Yisrael
I just thought that I can smooth the scrolling by using code and i also tried my site in another mobile it works fine but in ios device it does not scroll smooth
Hi Rishabh,
Strange. I tried it on my iPhone 7 Plus and it worked beautifully. Go figure.
The Wix Support Team can help you out.
Yisrael
Hi, did you ever get a solution to this? My wix lightbox is also long and scrolling is very glitchy.