弹出窗口上的滚动事件Microsoft Edge Browser无法正常工作

时间:2017-10-26 14:40:04

标签: jquery microsoft-edge

Jquery绑定鼠标滚轮事件以滚动弹出窗口不能与Microsoft Edge一起使用。

jQuery("#wrapper").unbind('mousewheel').mousewheel(
function(event, delta, deltaX, deltaY){
            console.log('mousewheel'+event);
                mainObj.checkout.scrollPopupWindow(event, delta, deltaX, deltaY, targetJqueryObject);
            }
        );

    scrollPopupWindow:function(event, delta, deltaX, deltaY, targetJqueryObject){
            console.log('scrollPopupWindow' +jQuery(window).scrollTop() );
        //if(mainObj.checkout.getScroll()){
            jQuery(document).mousedown();
            //if(jQuery(window).scrollTop() == 0 || jQuery(window).scrollTop() == 208){
                var winHeight = jQuery(window).height();
                var chkHeight = targetJqueryObject.height() + 60;
                var marginTop = 50;
                var marginBottom = 50;                              
                if(winHeight < (chkHeight + marginTop + 10)){           

                    if(deltaY == null || deltaY == undefined){
                        deltaY = 0;
                    }                                   
                    var multiple = 30;                                  
                    if(navigator.oscpu && navigator.oscpu.indexOf('Windows') != -1){
                        multiple = 30;
                    }else if(navigator.platform && navigator.platform.indexOf('Win') != -1){
                        multiple = 50;
                    }

                    var newTop = targetJqueryObject.offset().top + (deltaY * multiple);
                    var oldTop = targetJqueryObject.offset().top;

                    if(newTop > marginTop){
                        newTop = marginTop;
                    }
                    console.log('scrollPopupWindow newTop' +newTop);            
                    var chkVisible = chkHeight + newTop + marginBottom;                             
                    if(chkVisible <= winHeight){
                        newTop = -1 * (chkHeight - winHeight) - marginBottom;
                    }

0 个答案:

没有答案