Links on div elements dont work on mobile devices except iPad
After upgrading to the latest build and enabling touch, I am unable to click the links in div elements inside the scroller. Is there any way to make all links clickable. Not sure if this is a real issue.
Someone has to look into this.. this issue has been unanswered for a long time, without the ability to select links from the scroller, there is no point of making this usable on a mobile device.
I know this doesn't fix the issue for <a> elements, but in my case, I needed it to work on the iPad. My solution was to bind the "touchstart" event for the element that poses as a link, something like this:
$('elem').bind('touchstart', function() { console.log('Element tapped'); });
You can event make it work on both, desktop and iPad:
var userAgent = navigator.UserAgent;
ev = ua.match(/iPad/i) ? 'touchstart' : 'click';
$('elem').bind(ev, function() { console.log('Element tapped'); });
Hope it helps!
This could be the same problem I'm having with an image map. See post https://github.com/tkahn/Smooth-Div-Scroll/issues/153
Similar to macuenca's fix, this works for me on mobile. Rather than using bind, I use on because my divs are dynamically loaded.
var touchstart;
var touchend;
$('elem').on('touchstart',function(e) {
touchstart = e.originalEvent.touches[0].clientX;
});
$('elem').on('touchend', function(e) {
touchend = e.originalEvent.changedTouches[0].clientX;
if(touchend==touchstart) {
//technically, this is a 'tap'; perform actions here
}
});
Because the clientX has not changed between the touchstart and touchend event, it can be assumed that the user has simply tapped the screen, and not dragged.
@xxxjj18 I have the same problem, links, even though they prominently fill up enough space to click like a madman, cannot be clicked on mobile. How do I encorporate and utilise your fix exactly?
jQuery(document).ready(function () {
jQuery("#scroll_content").smoothDivScroll({
touchScrolling: true,
visibleHotSpotBackgrounds: "always",
mousewheelScrolling: "horizontal",
scrollingHotSpotRightVisibleClass: "scrolling_right",
scrollingHotSpotLeftVisibleClass: "scrolling_left"
});
});
is my code to call the scroller. I have various sub-tiles (divs) that contain anchors to other pages/content. Can you help out a bit :+1: :smile: ?
Any update on this matter? Not meaning to rush anyone, though :).