Coder Social home page Coder Social logo

Comments (4)

tkahn avatar tkahn commented on July 30, 2024

Interesting! I don't have a desktop computer with touch so feedback like this is very valuable. There is a fix to prevent selecting/highlighting of the elements in the scroller that I apply in the CSS for the elements inside the scrollable area:

    #makeMeScrollable div.scrollableArea *
    {
        position: relative;
        display: block;
        float: left;
        margin: 0;
        padding: 0;
        /* If you don't want the images in the scroller to be selectable, try the following
           block of code. It's just a nice feature that prevent the images from
           accidentally becoming selected/inverted when the user interacts with the scroller. */
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }

If you remove the prevent dragstart fix and apply the CSS above, does it work or do you need both? It would be great if you could test this for me! Thanks in advance!

/Thomas

from smooth-div-scroll.

LL782 avatar LL782 commented on July 30, 2024

Hi /Thomas

First up the dragstart fix does work without the CSS - which I hadn't realised.

Without the dragstart fix the CSS works for some elements of my slides and not others. Each of my slides are made up of h2, h3 and img elements all contained inside a link element:

<a class="slide">
    <h2>...</h2>
    <h3>...</h3>
    <img />
</a>

Interestingly, if I click and drag the img the CSS fix works but if I click and drag the header elements FF thinks I want to move the whole link element off the page and this gets in the way of the iTouch effect.

I should point out at this point that my desktop is not a touch device, I'm reporting on the effect of using iTouch on my regular desktop browser (Firefox 15.0.1)

Be happy to do more testing. Thanks for the code. It's great!

Laurence

from smooth-div-scroll.

tkahn avatar tkahn commented on July 30, 2024

Hi!

Hmm, this is a tricky one.
What happens if you change the CSS to:

#makeMeScrollable div.scrollableArea a
    {
        position: relative;
        display: block;
        float: left;
        margin: 0;
        padding: 0;
        /* If you don't want the images in the scroller to be selectable, try the following
           block of code. It's just a nice feature that prevent the images from
           accidentally becoming selected/inverted when the user interacts with the scroller. */
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
    }

...i.e. changing the "*" to an "a" to more precisely match your setup?

/Thomas

from smooth-div-scroll.

LL782 avatar LL782 commented on July 30, 2024

Hi /Thomas

I've amended my CSS - good call, there was no need to use a wildcard.

This doesn't change anything drag/select-wise. There is still a confusion when I click the titles to drag them but the images behave well if I drag them instead.

The dragstart-prevent-default solution seems to be a goodun:

My code looks like this:

$(document).ready(function () {

    $("div#slides").smoothDivScroll({
        autoScrollingMode: "always", 
        autoScrollingDirection: "endlessLoopRight",
        hotSpotScrolling: false,
        touchScrolling: true,
        manualContinuousScrolling: true
    });

    // Prevents slides being selected.
    $('div#slides').bind('dragstart', function(e) { e.preventDefault(); });
});

from smooth-div-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.