KindEditor.plugin('fixtoolbar', function (K) {
var self = this;
if (!self.fixToolBar) {
return;
}
function init() {
var toolbar = K('.ke-toolbar');
var originY = toolbar.pos().y;
K(window).bind('scroll', function () {
if (toolbar.css('position') == 'fixed') {
if(document.body.scrollTop - originY < 0){
toolbar.css('position', 'static');
toolbar.css('top', 'auto');
}
} else {
if (toolbar.pos().y - document.body.scrollTop < 0) {
toolbar.css('position', 'fixed');
toolbar.css('top', 0);
}
}
});
}
if (self.isCreated) {
init();
} else {
self.afterCreate(init);
}
});
<link rel="stylesheet" href="../../function/editor/themes/default/default.css" />
<script charset="utf-8" src="../../function/editor/kindeditor.js"></script>
<script charset="utf-8" src="../../function/editor/fixtoolbar.js"></script>
<script charset="utf-8" src="../../function/editor/lang/zh_CN.js"></script>
<script>
KindEditor.ready(function(K) {
K.create('textarea[id="container"]', {
allowFileManager : true,
autoHeightMode : true,
fixToolBar:true,
afterCreate : function() {
this.loadPlugin('autoheight');
}
});
});
</script>
欢迎光临 免费PHP万能建站系统_社区团购SaaS_商城系统_软件开发_虚拟币交易所系统_矿机系统_微信钻石投票系统_成品源码 (https://ourphp.net/club/) | Powered by Discuz! X3.2 |