mercredi 6 mai 2015

Triggering browser selection-scolling within an element, when selecting from outside

If we have a dom element whose content forces scrolling, selection within the element will trigger scrolling behaviour if the mouse moves outside the box. It's basic UI stuff.

The question is - can we trigger the same behaviour if selection begins outside the box without resorting to tracking the coordinates of the mouse through javascript and using scrollTo methods.

In other words, is there anything either in css (unlikely), or simple scripting events (I tried focusing on the containing element on mouse enter in order to 'capture' the selection but that didn't work) which would allow the ability to continue to scroll through the content of the constrained element?

    <div style="
      overflow: auto; 
      height: 300px; 
      width: 300px; 
      outline: solid 1px Red;
   ">... lots of content more than 300px high ... </div>

Plunker here. Thanks.

Aucun commentaire :

Enregistrer un commentaire