On Jan 9, 2016, at 9:12 PM, Karl DeSaulniers <k...@designdrumm.com> wrote:

> You don't. 
> 
> You can but that is a little silly IMO.
> Hover is a mouse event meant for interaction with a mouse.
> Until the screen can detect your finger hovering over it, there is no need to 
> set hover for mobile.
> I know this statement may come with a backlash from some evangelicals, 
> however think about it.
> Do you put wings on a car just because you can? Just for looks?
> 
> Design for your device. Leave the mouse events for the mouse and the click 
> events for mobile to turn into tap events.
> If you really must have hover events on mobile, then javascript/jQuery is the 
> way to go.
> it includes setting a timeout to see if their finger has stayed on the screen 
> for so long past a click.
> 
> Best,
> 
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
> 
> 
> 

In case anyone needs. Here is a jQuery function to handle touch. 

var clickTime = new Date() ;
var clickSP = 300 ;

$(your_link).bind("touchstart", function(e){
        var nowTime = new Date(),
        t = parseInt(nowTime.getTime() - clickTime.getTime());
        if ((t < clickSP) && (e.originalEvent.touches.length == 1)) {
                //fire off your hover event
        }
        clickTime = nowTime ;
});

It has more uses than just firing off hover events, just FYI. ;)

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to