Showing posts with label scrollbar. Show all posts
Showing posts with label scrollbar. Show all posts

Tuesday, July 12, 2011

Change the style of the scrollbar

http://www.stockvault.net/tutorials/css-scrollbar-colors

BODY {
SCROLLBAR-FACE-COLOR: #000000; 
SCROLLBAR-HIGHLIGHT-COLOR: #000000; 
SCROLLBAR-SHADOW-COLOR: #000000; 
SCROLLBAR-3DLIGHT-COLOR: #000000; 
SCROLLBAR-ARROW-COLOR: #000000; 
SCROLLBAR-TRACK-COLOR: #000000;
SCROLLBAR-DARKSHADOW-COLOR: #000000; 
}

HIde Horizontal Scrollbar

To make a div scrollable, use overflow:auto in the css.
To hide a scrollbar, use overflow-x:hidden

Wednesday, December 16, 2009

Continue scrolling while mouseover - Silverlight

Context: While mouse cursor is over an object (i.e. button, image, canvas), a function should continue to occur. This is useful for continuous horizontal scrolling of menu items.

The idea is to declare two DispatcherTimer objects (one for each direction of scrolling). You can set the interval of the timer objects accordingly. The Tick property defines the method that the timer calls at each interval.


private System.Windows.Threading.DispatcherTimer _ScrollUpDispatcherTimer;
private System.Windows.Threading.DispatcherTimer _ScrolDownDispatcherTimer;

private void bNext_MouseEnter(object sender, MouseEventArgs e)
{
_ScrolDownDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
_ScrolDownDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 300);
_ScrolDownDispatcherTimer.Tick += new EventHandler(ScrollDown_Each_Tick);
_ScrolDownDispatcherTimer.Start();
}
private void bPrev_MouseEnter(object sender, MouseEventArgs e)
{
_ScrollUpDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
_ScrollUpDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 300);
_ScrollUpDispatcherTimer.Tick += new EventHandler(ScrollUp_Each_Tick);
_ScrollUpDispatcherTimer.Start();
}

public void ScrollUp_Each_Tick(object o, EventArgs sender)
{
//scroll-up function
}
public void ScrollDown_Each_Tick(object o, EventArgs sender)
{
//scroll-down function
}

private void bPrev_MouseLeave(object sender, MouseEventArgs e)
{
_ScrollUpDispatcherTimer.Stop();
}
private void bNext_MouseLeave(object sender, MouseEventArgs e)
{
_ScrolDownDispatcherTimer.Stop();
}

Remember to call the respective stop() functions in the scrolling functions if there is nothing more to scroll.

Friday, April 10, 2009

Add Scrollbar within Body of Page

You might want to do something like this:


Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque ullamcorper dictum est. Aenean ante diam, porttitor sed, sodales nec, scelerisque eu, lectus. Vestibulum auctor massa sit amet nibh malesuada consectetuer. Etiam augue felis, faucibus sed, mattis ac, imperdiet ac, felis. Morbi iaculis. Vestibulum augue mi, vulputate sed, tristique sit amet, ornare et, lectus. Sed rhoncus, pede nec adipiscing tristique, nibh libero facilisis sapien, eget rutrum eros erat eu tortor. Cras at magna. Etiam mattis. Aliquam erat volutpat. Donec risus. Fusce justo. Vivamus enim lacus, sagittis ut, tincidunt in, congue ut, orci. Praesent quis libero vel lectus mattis sagittis. Sed augue libero, viverra et, rutrum hendrerit, porta id, ligula. Integer lacinia.

Here's how you can achieve it using "div":

<div style="width: 100px; height: 200px; overflow: auto;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque ullamcorper dictum est. Aenean ante diam, porttitor sed, sodales nec, scelerisque eu, lectus. Vestibulum auctor massa sit amet nibh malesuada consectetuer. Etiam augue felis, faucibus sed, mattis ac, imperdiet ac, felis. Morbi iaculis. Vestibulum augue mi, vulputate sed, tristique sit amet, ornare et, lectus. Sed rhoncus, pede nec adipiscing tristique, nibh libero facilisis sapien, eget rutrum eros erat eu tortor. Cras at magna. Etiam mattis. Aliquam erat volutpat. Donec risus. Fusce justo. Vivamus enim lacus, sagittis ut, tincidunt in, congue ut, orci. Praesent quis libero vel lectus mattis sagittis. Sed augue libero, viverra et, rutrum hendrerit, porta id, ligula. Integer lacinia.
</div>

You can control the height and width of the div and the overflow attribute signifies that the div is scrollable if the text overflows.

Source: http://www.htmlcodetutorial.com/help/sutra22436.html
Credit goes to Corey Bryant, Site Admin