|
23 | 23 | KWINDOW = ".k-window", |
24 | 24 | KICONCLOSE = ".k-dialog-close", |
25 | 25 | KCONTENTCLASS = "k-content k-window-content k-dialog-content", |
| 26 | + KCONTENTSELECTOR = ".k-window-content", |
26 | 27 | KCONTENT = ".k-content", |
27 | 28 | KSCROLL = "k-scroll", |
28 | 29 | KTITLELESS = "k-dialog-titleless", |
|
39 | 40 | ZINDEX = "zIndex", |
40 | 41 | BODY = "body", |
41 | 42 | INITOPEN = "initOpen", |
| 43 | + TOUCHSTART = "touchstart", |
| 44 | + TOUCHMOVE = "touchmove", |
42 | 45 | OPEN = "open", |
43 | 46 | CLOSE = "close", |
44 | 47 | SHOW = "show", |
|
52 | 55 | HIDDEN = "hidden", |
53 | 56 | OVERFLOW = "overflow", |
54 | 57 | DATADOCOVERFLOWRULE = "original-overflow-rule", |
| 58 | + DATAHTMLTAPYRULE = "tap-y", |
55 | 59 | HUNDREDPERCENT = 100, |
56 | 60 | messages = { |
57 | 61 | okText : "OK", |
|
720 | 724 | $body.css(OVERFLOW, HIDDEN); |
721 | 725 |
|
722 | 726 | var $html = $("html"); |
| 727 | + var html = $html[0]; |
723 | 728 | that._storeOverflowRule($html); |
724 | 729 | $html.css(OVERFLOW, HIDDEN); |
| 730 | + |
| 731 | + // prevent touch due to bug in ios |
| 732 | + if (kendo.support.mobileOS.ios) { |
| 733 | + html.addEventListener(TOUCHSTART, that._touchStart, { passive: false }); |
| 734 | + html.addEventListener(TOUCHMOVE, that._touchMove, { passive: false }); |
| 735 | + } |
| 736 | + }, |
| 737 | + |
| 738 | + _touchStart: function (e) { |
| 739 | + $(this).data(DATAHTMLTAPYRULE, e.changedTouches[0].pageY); |
| 740 | + }, |
| 741 | + |
| 742 | + _touchMove: function (e) { |
| 743 | + var target = e.target; |
| 744 | + var $target = $(e.target); |
| 745 | + var upScroll = e.changedTouches[0].pageY - $(this).data(DATAHTMLTAPYRULE) > 0; |
| 746 | + var preventYScroll = $target.is(KCONTENTSELECTOR) && |
| 747 | + (upScroll && $target.scrollTop() === 0) || |
| 748 | + (!upScroll && $target.scrollTop() === target.scrollHeight - target.clientHeight); |
| 749 | + if (!$target.is(KCONTENTSELECTOR) || preventYScroll) { |
| 750 | + e.preventDefault(); |
| 751 | + } |
725 | 752 | }, |
726 | 753 |
|
727 | 754 | _enableDocumentScrolling: function(){ |
728 | 755 | var that = this; |
| 756 | + var $body = $(document.body); |
| 757 | + var $html = $("html"); |
| 758 | + var html = $html[0]; |
729 | 759 |
|
730 | | - that._restoreOverflowRule($(document.body)); |
731 | | - that._restoreOverflowRule($("html")); |
| 760 | + that._restoreOverflowRule($body); |
| 761 | + that._restoreOverflowRule($html); |
| 762 | + |
| 763 | + if (kendo.support.mobileOS.ios) { |
| 764 | + $html.removeData(DATAHTMLTAPYRULE); |
| 765 | + html.removeEventListener(TOUCHSTART, that._touchStart, { passive: false }); |
| 766 | + html.removeEventListener(TOUCHMOVE, that._touchMove, { passive: false }); |
| 767 | + } |
732 | 768 | }, |
733 | 769 |
|
734 | 770 | _storeOverflowRule: function($element){ |
|
0 commit comments