|
|
|
@ -720,9 +720,9 @@
|
|
|
|
|
if (!toggle) return; |
|
|
|
|
|
|
|
|
|
var handle = toggle.querySelector('.toggle-handle'); |
|
|
|
|
var toggleWidth = toggle.offsetWidth; |
|
|
|
|
var handleWidth = handle.offsetWidth; |
|
|
|
|
var offset = toggle.classList.contains('active') ? (toggleWidth - handleWidth) - 2 : 0; |
|
|
|
|
var toggleWidth = toggle.clientWidth; |
|
|
|
|
var handleWidth = handle.clientWidth; |
|
|
|
|
var offset = toggle.classList.contains('active') ? (toggleWidth - handleWidth) : 0; |
|
|
|
|
|
|
|
|
|
start = { pageX : e.touches[0].pageX - offset, pageY : e.touches[0].pageY }; |
|
|
|
|
touchMove = false; |
|
|
|
@ -737,9 +737,9 @@
|
|
|
|
|
|
|
|
|
|
var handle = toggle.querySelector('.toggle-handle'); |
|
|
|
|
var current = e.touches[0]; |
|
|
|
|
var toggleWidth = toggle.offsetWidth; |
|
|
|
|
var handleWidth = 28; |
|
|
|
|
var offset = (toggleWidth - handleWidth) - 2; |
|
|
|
|
var toggleWidth = toggle.clientWidth; |
|
|
|
|
var handleWidth = handle.clientWidth; |
|
|
|
|
var offset = toggleWidth - handleWidth; |
|
|
|
|
|
|
|
|
|
touchMove = true; |
|
|
|
|
distanceX = current.pageX - start.pageX; |
|
|
|
@ -760,9 +760,9 @@
|
|
|
|
|
if (!toggle) return; |
|
|
|
|
|
|
|
|
|
var handle = toggle.querySelector('.toggle-handle'); |
|
|
|
|
var toggleWidth = toggle.offsetWidth; |
|
|
|
|
var handleWidth = 28; |
|
|
|
|
var offset = (toggleWidth - handleWidth) - 2; |
|
|
|
|
var toggleWidth = toggle.clientWidth; |
|
|
|
|
var handleWidth = handle.clientWidth; |
|
|
|
|
var offset = (toggleWidth - handleWidth); |
|
|
|
|
var slideOn = (!touchMove && !toggle.classList.contains('active')) || (touchMove && (distanceX > (toggleWidth/2 - handleWidth/2))); |
|
|
|
|
|
|
|
|
|
if (slideOn) handle.style.webkitTransform = 'translate3d(' + offset + 'px,0,0)'; |
|
|
|
|