jQuery UI sliders on touch devices

前端 未结 4 1993
慢半拍i
慢半拍i 2020-12-07 08:11

I\'m developing a website using jQuery UI, and there are several elements on my site that appear to be incompatible when viewed on touchscreen devices; they don\'t cause any

4条回答
  •  情歌与酒
    2020-12-07 09:08

    As @dazbradbury suggested, the touchpunch library can help translate the mouse events to touch events. The parameters in .draggable() limit the movement of the slider so it can't be moved beyond its slider parent.

    
    
    
    
    

    EDIT: If you are already using a Jquery UI slider, you only need to include the touchpunch library. Do not call .draggable() for the .ui-slider-handle because it will overwrite the existing functionality.

提交回复
热议问题