Colorbox stop background scroll and return to same location on parent page-open source projects jackmoore/colorbox

I have an unordered list that I’ve created in drupal 7 using views. Each list item has a link that opens a colorbox. If you put the mouse on the faded background of the colorbox (which is the parent page) you can scroll the parent page. What I’m after is the parent page to stop scrolling and return to the same position/anchor on parent page when its closed.

Searching through questions on here I found the code: $(document).bind('cbox_open', function () { $('html').css({ overflow: 'hidden' }); }).bind('cbox_closed', function () { $('html').css({ overflow: 'auto' }); });

The code above works but puts the parent page scroll back to the very top.

This would work if I could do it dynamically;

$("html,body").scrollTop(400); // 300 is just a example

Any ideas?