Jquery 在滚动时锁定工具栏
我正在尝试修复工具栏,以便当有人在textAngular编辑器仍在视图中的情况下向下滚动页面时(或者向下滚动编辑器本身),工具栏始终可见 滚动时工具栏不再可见: 使用Jquery 在滚动时锁定工具栏,jquery,css,angularjs,textangular,Jquery,Css,Angularjs,Textangular,我正在尝试修复工具栏,以便当有人在textAngular编辑器仍在视图中的情况下向下滚动页面时(或者向下滚动编辑器本身),工具栏始终可见 滚动时工具栏不再可见: 使用position:fixed只需将其固定在整个页面的顶部即可 我已尝试使用以下jQuery在查看textAngular指令时在滚动时修复它: $(document).load( function() { var textEditor = $(".ta-root"); var toolbar = $(".ta-toolba
position:fixed
只需将其固定在整个页面的顶部即可
我已尝试使用以下jQuery在查看textAngular指令时在滚动时修复它:
$(document).load( function() {
var textEditor = $(".ta-root");
var toolbar = $(".ta-toolbar");
$(document).on("scroll", function(e) {
if (textEditor.offset().top < $(document).scrollTop() < textEditor.offset().top + textEditor.height() ) {
toolbar.css('position', 'fixed');
} else {
toolbar.css('position', 'static');
}
});
});
$(文档).load(函数(){
var textEditor=$(“.ta root”);
变量工具栏=$(“.ta工具栏”);
$(文档)。打开(“滚动”,功能(e){
if(textEditor.offset().top<$(文档).scrollTop()
然而,一切都没有发生。我不确定这是改变角度指令行为的最佳方式。有人知道我怎样才能做到这一点吗
嘿,看看repo中的demo/static-demo.html。它有一个
静态工具栏的示例
以下链接的回复: