Madhur
Madhur

Reputation: 21

lightbox showing on top of the window

my jquery datatable is too large intially i am showing data with the lightbox which contains html page. I have 100 rows intially. But when i show my lightbox it is opened on top of the window so user have to go on top and somtimed he feels nothing happens beacuse lightbox is not visible. Please show to open my lightbox on same location or when user click to show lightbox page would automatically scroll on top but i prefer if first is implemented. Thanks in advance...

Upvotes: 1

Views: 925

Answers (1)

TNC
TNC

Reputation: 5386

You can just scroll your lightbox to where they're looking. Something like:

$(window).scroll(function()
{
    $('#lightbox').stop().animate({ "marginTop": ($(window).scrollTop() - 50) + "px" }, "slow");
});

You'll want to call that after the lightbox is shown.

Upvotes: 2

Related Questions