Online Search "Left and right slide switch", the result has many such as: pure CSS3 left and right slide switch button and so on. But in fact, this button is triggered by the Click event. On the Mobile Web page with this component, for the iphone users, see a lot more of these sliding buttons, if the click Trigger, it will appear very uncoordinated.
To be blunt, this kind of button on the net is click button rather than Slide button. We are now looking for a sliding event to replace the Click event, and the first thing to think about is the touch-related event, which was later found on Wscschool.
Swipe event: http://www.w3school.com.cn/jquerymobile/jquerymobile_events_touch.asp;.
This solution requires the introduction of jquery Mobile, and it is important to note that the introduction of this JS results in a series of added styles.
Code:
<!doctype html>
At this point, the switch from the click is turned into a sliding switch. A little bit of a problem, actually I didn't just use the jquery mobile
Swipe event, the other is not used, it is necessary to take this event separately to refer to. Consider this later.
Mobile Web effects: Left and right slide switch