开发者

How to enable scrollbars in Windows Sidebar Gadgets?

开发者 https://www.devze.com 2023-02-01 15:37 出处:网络
I would like to make the entire gadgetContent div of my Sidebar Gadget scrollable if its content overflows its height. I can get a scrollbar to show up. Unfortunately, any time I click+drag this bar,

I would like to make the entire gadgetContent div of my Sidebar Gadget scrollable if its content overflows its height. I can get a scrollbar to show up. Unfortunately, any time I click+drag this bar, I move the entire gadget. Here's my CSS:

div#gadgetContent {
  overflow: auto;
  height: 240px;
}

Is there a way to get the scrollbar's behavior to override the Gadget's click+drag movement?

Thanks in advance!

edit: I discovered that HTML scrollbars actually do work within Sidebar gadgets. I had some CSS in my g:background element that was preventing scrollbars from being clickable. HTML scrollbars started working the wa开发者_C百科y I expected them to once I fixed the problem.


You can set an empty onclick handler for the div, but then dragging will be prevented for the entire content of the element, not just the scrollbars.

The best approach is to create your own scrollbars or use an existing library out there (this one, for example). This way, you can apply the appropriate event handlers to the scrollbar controls which will automatically prevent dragging when they are clicked.

0

精彩评论

暂无评论...
验证码 换一张
取 消