Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

nsIScrollable

This interface can be implemented by a control that supports scrolling. This is a generic interface without concern for the type of content that may be inside.
Inherits from: nsIScrollable Last changed in Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

Method overview

long getCurScrollPos(in long scrollOrientation); Obsolete since Gecko 29.0
long getDefaultScrollbarPreferences(in long scrollOrientation);
void getScrollbarVisibility(out boolean verticalVisible, out boolean horizontalVisible);
void getScrollRange(in long scrollOrientation, out long minPos, out long maxPos); Obsolete since Gecko 29.0
void setCurScrollPos(in long scrollOrientation, in long curPos); Obsolete since Gecko 29.0
void setCurScrollPosEx(in long curHorizontalPos, in long curVerticalPos); Obsolete since Gecko 29.0
void setDefaultScrollbarPreferences(in long scrollOrientation, in long scrollbarPref);
void setScrollRange(in long scrollOrientation, in long minPos, in long maxPos); Obsolete since Gecko 29.0
void setScrollRangeEx(in long minHorizontalPos, in long maxHorizontalPos, in long minVerticalPos, in long maxVerticalPos); Obsolete since Gecko 29.0

Constants

Scroll orientations

Scroll orientations a scrollbar can be in.

Constant Value Description
ScrollOrientation_X 1 Horizontal scrolling. When passing this in to a method you are requesting or setting data for the horizontal scrollbar.
ScrollOrientation_Y 2 Vertical scrolling. When passing this in to a method you are requesting or setting data for the vertical scrollbar.

Scrollbar states

Visibility states of a scrollbar.

Constant Value Description
Scrollbar_Auto 1 Scrollbars visible only when needed.
Scrollbar_Never 2 Scrollbars never visible, even when scrolling is still possible.
Scrollbar_Always 3 Scrollbars always visible, even when scrolling is not possible.

Methods

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

getCurScrollPos()

long getCurScrollPos(
  in long scrollOrientation
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
Return value

 

getDefaultScrollbarPreferences()

long getDefaultScrollbarPreferences(
  in long scrollOrientation
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
Return value

An integer representing the state of the scrollbar.

getScrollbarVisibility()

void getScrollbarVisibility(
  out boolean verticalVisible,
  out boolean horizontalVisible
);
Parameters
verticalVisible
Boolean specifying the visibility of the vertical scrollbar.
horizontalVisible
Boolean specifying the visibility of the horizontal scrollbar.

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

getScrollRange()

void getScrollRange(
  in long scrollOrientation,
  out long minPos,
  out long maxPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
minPos
Minimal position of the scroll range.
maxPos
Maximal position of the scroll range.

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

setCurScrollPos()

void setCurScrollPos(
  in long scrollOrientation,
  in long curPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
curPos
An integer representing the position of the cursor.

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

setCurScrollPosEx()

void setCurScrollPosEx(
  in long curHorizontalPos,
  in long curVerticalPos
);
Parameters
curHorizontalPos
An integer representing the horizontal position of the cursor.
curVerticalPos
An integer representing the vertical position of the cursor.

setDefaultScrollbarPreferences()

void setDefaultScrollbarPreferences(
  in long scrollOrientation,
  in long scrollbarPref
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
scrollbarPref
An integer representing the state of the scrollbar.

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

setScrollRange()

void setScrollRange(
  in long scrollOrientation,
  in long minPos,
  in long maxPos
);
Parameters
scrollOrientation
An integer representing the orientation of the scrollbar.
minPos
An integer representing the minimal position of the scroll range.
maxPos
An integer representing the maximal position of the scroll range.

Obsolete since Gecko 29.0 (Firefox 29.0 / Thunderbird 29.0 / SeaMonkey 2.26)

setScrollRangeEx()

void setScrollRangeEx(
  in long minHorizontalPos,
  in long maxHorizontalPos,
  in long minVerticalPos,
  in long maxVerticalPos
);
Parameters
minHorizontalPos
An integer representing the minimal position of the horizontal scroll range.
maxHorizontalPos
An integer representing the maximal position of the horizontal scroll range.
minVerticalPos
An integer representing the minimal position of the vertical scroll range.
maxVerticalPos
An integer representing the maximal position of the vertical scroll range.

Example

var nsiScr = gBrowser.selectedBrowser.docShell.QueryInterface(Components.interfaces.nsIScrollable);
var v={};
var h={};

nsiScr.getScrollbarVisibility(v,h);

v.value //returns true if the vertical scrollbar is displayed
h.value //returns true if the horizontal scrollbar is displayed

Document Tags and Contributors

Tags: 
 Contributors to this page: Sheppy, Sebastianz, justinpotts, Yansky0
 Last updated by: Sheppy,