Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change cursor image on scrollbar in chrome

I need to change custom cursor for scrollbar in Chrome. I have lightbox which has set custom cursor with big X and Close text. Problem is that in chrome the cursor definition is inherited by the scrollbar as well, which looks a bit funny.

See the fiddle:

<div class="below">
    <div class="full">
         <div class="scrollable">long text</div>
    </div>
</div>

CSS:

.full{
    position:fixed;
    background:red;
    height:100%;
    width:80%;
    overflow-y:scroll;
    cursor: url('cursor.cur'),not-allowed;
}
.scrollable{
    padding:1em;
    background:white;
    position:relative;
    display:block;
    width:80%;
    margin:50px auto;
}

http://jsfiddle.net/3fY9r/1/

is there any way how to trigger the scrollbar only and change the appearance back to default cursor?

like image 342
Jan Avatar asked May 20 '14 15:05

Jan


People also ask

How do I change my scrollbar cursor?

Customize cursor. The basic way to customize your cursor is by using the cursor property with url() value. One thing to remember here is you have to use the auto as a fallback value. However, with cursor: url('...'), auto; you don't have that much control.

Why does my mouse pointer change to a scroll bar?

If your cursor changes to an arrow, you might have pressed the middle button or scroll wheel on your mouse accidentally. This is not a problem until it starts occurring frequently. If this problem occurs frequently, you should scan your system with antivirus and update or reinstall your mouse driver. Hope this helps.


1 Answers

You can use the vendor selectors for chrome's scrollbar to set styles. However, I don't think it will allow you to change the cursor. You could try this to see if it works:

::-webkit-scrollbar {
    cursor:pointer;
}

UPDATE

After looking more into this issue, apparently there is a bug with Chrome and updates to the cursor on scrollbars. Here is the ticket, it is still open. You can still change the styles, but the customizations seem a bit limited.

like image 124
Matthew R. Avatar answered Sep 30 '22 07:09

Matthew R.