Keep Colorbox always centered on scroll

Jason picture Jason · Nov 30, 2010 · Viewed 8.8k times · Source

When using thickbox if a user scrolled vertically the thickbox would always stay centered. However with colorbox if they scroll they lose site of the colorbox and just see a grayed out background. How can I update colorbox to have the same functionality where it maintains position on the screen regardless of user scrolling.

http://colorpowered.com/colorbox/core/example1/index.html http://jquery.com/demo/thickbox/

resize your window to have a vertical scrollbar and scroll and you can see the difference.

Thanks

Answer

s427 picture s427 · Sep 16, 2011

I may be a bit late, but FYI you can simply use the "fixed" option in your colorbox declaration. This option is "false" by default. If you set it to "true" you get the result you want:

$('#my_box').colorbox({
    fixed: true
 });