Skip to content

Commit

Permalink
feat: optimize sticky sidebar (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonjiang committed Jun 25, 2021
1 parent 711f5a3 commit 2d0d779
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
11 changes: 1 addition & 10 deletions assets/js/kratos.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Kratos
* Seaton Jiang <seaton@vtrois.com>
* Seaton Jiang <seatonjiang@vtrois.com>
*/
(function () {
"use strict";
Expand Down Expand Up @@ -168,12 +168,6 @@
});
};

var siderbarConfig = function () {
$(".sticky-sidebar").theiaStickySidebar({
additionalMarginTop: 25,
});
};

var consoleConfig = function () {
console.log(
"\n Kratos v" +
Expand All @@ -193,9 +187,6 @@
postlikeConfig();
donateConfig();
consoleConfig();
if (kratos.sticky) {
siderbarConfig();
}
});
})();

Expand Down
1 change: 0 additions & 1 deletion assets/js/kratos.min.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/theia-sticky-sidebar.min.js

This file was deleted.

6 changes: 4 additions & 2 deletions inc/theme-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ function theme_autoload()
wp_add_inline_style('kratos', $admin_bar_css);
}
}
if (kratos_option('g_sticky', false)) {
$sticky_css = ".sticky-sidebar{position: sticky;top: 25px;height:100%}";
wp_add_inline_style('kratos', $sticky_css);
}
// js
wp_deregister_script('jquery');
wp_enqueue_script('jquery', ASSET_PATH . '/assets/js/jquery.min.js', array(), '3.4.1', false);
wp_enqueue_script('bootstrap-bundle', ASSET_PATH . '/assets/js/bootstrap.bundle.min.js', array(), '4.5.0', true);
wp_enqueue_script('layer', ASSET_PATH . '/assets/js/layer.min.js', array(), '3.1.1', true);
// wp_enqueue_script('sticky', ASSET_PATH . '/assets/js/theia-sticky-sidebar.min.js', array(), '1.5.0', true);
wp_enqueue_script('dplayer', ASSET_PATH . '/assets/js/DPlayer.min.js', array(), THEME_VERSION, true);
wp_enqueue_script('kratos', ASSET_PATH . '/assets/js/kratos.js', array(), THEME_VERSION, true);

Expand All @@ -89,7 +92,6 @@ function theme_autoload()
'thanks' => __('感谢您的支持', 'kratos'),
'donate' => __('打赏作者', 'kratos'),
'scan' => __('扫码支付', 'kratos'),
'sticky' => kratos_option('g_sticky', false),
);
wp_localize_script('kratos', 'kratos', $data);
}
Expand Down

0 comments on commit 2d0d779

Please sign in to comment.