タグ

tipsとScrollBarに関するastk_fのブックマーク (2)

  • スクロールバーの幅

    スクロールバーの幅を知りたいことはままある。CSSで拾えれば最高なのだけど……というところで、calc(100vw - 100%)で拾えることがわかった。ただこれで拾えるかどうかはその要素の親に依存するので、いつでもどこでも使えるわけではない。せめてJavaScriptでは扱えるようにしてみたい。 Demo: Get Scrollbar Width with JavaScript ボタンをクリックするとスクロールバーの幅がダイアログで表示される。オーバーレイのスクロールバーの場合は0pxになり、そうでない場合はスクロールバーの幅が返る。body要素の幅が100%であることが条件になるが、まず大丈夫だろう。 仕組みは単純なものでwidthプロパティーをcalc(100vw - 100%)にした要素をbody要素の子に突っ込んで、計算済みスタイルを拾うというだけだ。overflowプロパティー

    スクロールバーの幅
  • Auto-scrolling a Spark TextArea control in Flex 4 | Flex Examples

    In a previous example, “Auto-scrolling a TextArea control in Flex”, we saw how you could auto-scroll a Flex Halo TextArea control when new content is added by setting the verticalScrollPosition property to the value of the maxVerticalScrollPosition property. The following example shows how you can auto-scroll a Flex 4 Spark TextArea control using the appendText() method. Full code after the jump.

  • 1