简体   繁体   中英

Lightbox scroll to the top

I am implementing the following code: JSFiddle

Everything with the lightbox works fine. However when I open the lightbox it shows the middle of the content and I have to manually scroll to the top. I have tried to implement Javascript code

    $('#light').each(function(){
    $(this).click(function(){ 
        $('html,body').animate({ scrollTop: 0 }, 'slow');
        return false; 
    });
});

However it seems it does not work. Can anyone help please?

Thanks

用href =“#”替换href =“ javascript:void(0)”

在您的.white_content类中,将top:0 更新top:115px这可能有助于您放置灯箱而不滚动到顶部

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM