Smooth-Div-Scroll icon indicating copy to clipboard operation
Smooth-Div-Scroll copied to clipboard

Links on div elements dont work on mobile devices except iPad

Open imahboob opened this issue 12 years ago • 6 comments

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.

imahboob avatar Feb 12 '13 00:02 imahboob

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.

mahboobi avatar May 02 '13 05:05 mahboobi

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!

macuenca avatar Aug 03 '13 20:08 macuenca

This could be the same problem I'm having with an image map. See post https://github.com/tkahn/Smooth-Div-Scroll/issues/153

JonyIvy avatar Jan 17 '14 14:01 JonyIvy

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.

jgarnet avatar Aug 06 '14 15:08 jgarnet

@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: ?

enoversum avatar Oct 29 '14 16:10 enoversum

Any update on this matter? Not meaning to rush anyone, though :).

enoversum avatar Nov 04 '15 11:11 enoversum