Sha256: 1cd5aec49ce61193da30aca87d1de611985f0da623bdf3d52bf32ce56f59dfbf

Contents?: true

Size: 883 Bytes

Versions: 6

Compression:

Stored size: 883 Bytes

Contents

/**
 * Created by chenyihong on 14/12/4.
 */

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);
    }

});

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rails_kindeditor-0.5.1 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js
rails_kindeditor_video-0.5.2 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js
rails_kindeditor_video-0.5.1 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js
rails_kindeditor-0.5.0 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js
rails_kindeditor-0.4.7 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js
rails_kindeditor-0.4.6 vendor/assets/javascripts/kindeditor/plugins/fixtoolbar/fixtoolbar.js