今天发文章的时候 发现用户体验更差了 如图
不能直接用overflow把滚动条给隐藏掉 查了下资料 可以用position:fixed模拟出隐藏滚动条并且记录隐藏前滚动条的位置 然后设置top负数滚动条
//去到26852行 //删除$('html,body').removeAttr('style'); this.closeButton = new Button({ className: 'edui-dialog-closebutton', title: me.closeDialog, theme:theme, onclick: function (){ me.close(false); //修改处 $('body').removeAttr('style'); $(document).scrollTop(scrollTop); } });
//去到27843行 //删除$('html,body').removeAttr('style'); }, type == 'ok' ? { buttons:[ { className:'edui-okbutton', label:editor.getLang("ok"), editor:editor, onclick:function () { dialog.close(true); //修改处 $('body').removeAttr('style'); $(document).scrollTop(scrollTop); } }, { className:'edui-cancelbutton', label:editor.getLang("cancel"), editor:editor, onclick:function () { dialog.close(false); //修改处 $('body').removeAttr('style'); $(document).scrollTop(scrollTop); } } ] }
//去到27867行 //删除html.css('overflow','hidden'); var ui = new editorui.Button({ className:'edui-for-' + cmd, title:title, onclick:function () { if (dialog) { switch (cmd) { case "wordimage": var images = editor.execCommand("wordimage"); if (images && images.length) { dialog.render(); dialog.open(); } break; //加入下面代码 参考图如下 case "insertimage": dialog.render(); dialog.open(); //修改处 scrollTop=$(document).scrollTop(); $('body').css({'position':'fixed','top':-scrollTop}); break; case "scrawl": if (editor.queryCommandState("scrawl") != -1) { dialog.render(); dialog.open(); } break; default: dialog.render(); dialog.open(); } } },
保存并压缩js 上传到服务器刷新bug修复好了
有意思!
特别厉害!