gpt4 book ai didi

jquery - 将文本 Angular 工具栏固定在滚动条上

转载 作者:行者123 更新时间:2023-11-28 16:36:27 25 4
gpt4 key购买 nike

我正在尝试修复工具栏,以便当有人向下滚动页面且 textAngular 编辑器仍在 View 中(或者向下滚动编辑器本身)时,它始终可见。

enter image description here

工具栏在滚动时不再可见:

enter image description here

使用 position: fixed 只是将它固定到整个页面的顶部。

当 textAngular 指令处于 View 中时,我尝试使用以下 jQuery 在滚动时修复它:

$(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');
}

});
});

然而什么也没有发生。不确定这是尝试改变 Angular Directive(指令)行为的最佳方式。有谁知道我可以如何实现这一点?

最佳答案

Hey, have a look at the demo/static-demo.html in the repo. It has an example of a static toolbar.

来自以下链接的回复:https://github.com/fraywing/textAngular/issues/697

关于jquery - 将文本 Angular 工具栏固定在滚动条上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454881/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com