开发者

jQuery Lightbox single image display

开发者 https://www.devze.com 2023-04-10 07:52 出处:网络
Is there a way to make lightbox only show the image clicked on and not show an entire gallery. I am not interested in giving the user the ability to see other images aside fro开发者_运维百科m the one

Is there a way to make lightbox only show the image clicked on and not show an entire gallery. I am not interested in giving the user the ability to see other images aside fro开发者_运维百科m the one they clicked on, but the documentation doesn't seem to reflect this functionality.

Any help or examples would be greatly appreciated.


Try adding this to your CSS:

#lightbox-nav a {
    display:none !important;
}


you can hide the navigation as explained in another answer here but a nice solution is to initialize the lightbox plugin on each item separately.

instead of $('#gallery a').lightBox(); you can do this:

$('#gallery a').each(function(){
    $(this).lightBox();
});

the gallery is actually made of each item that fits the selector, if you select 10 items those will be your gallery, but if you launch .lightBox() on each separately, they each get added to their own gallery (convenientely the plugin hides the controls when only 1 items is in the gallery.)

see an example here: http://jsfiddle.net/saelfaer/kwdBf/

0

精彩评论

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

关注公众号