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