1

I am trying to fix the toolbar so that it it is visible at all times when someone scrolls down the page with the textAngular editor still in view (or alternatively scrolls down the editor itself).

enter image description here

Toolbar no longer visible upon scrolling:

enter image description here

Using position: fixed just pins it to the top of the entire page.

I have tried using the following jQuery to fix it upon scrolling when the textAngular directive is in view:

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

  });
});

Nothing is happening however. Not sure this is the best way to be attempting to alter the behaviour of an angular directive anyway. Does anyone have any idea of how I might accomplish this?

Emile Paffard-Wray
  • 1,006
  • 2
  • 9
  • 17

1 Answers1

1

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

Reply from the following link: https://github.com/fraywing/textAngular/issues/697

user1242321
  • 1,578
  • 2
  • 18
  • 30