0

是否有从自定义按钮启动 Lightbox 的选项

就像是:

<a class="bttn">START</a>

<div>
  <a href="image/path" rel="imgs">img</a>
</div>

JS:

$('.bttn').click(function(){
   $.slimbox($('div a'), 2); //2 slimbox startimage; 
});
4

1 回答 1

0

解决方案:

$('.bttn').click(function(){                    
            var linkMapper = linkMapper || function(el) {   
                   return [el.href, el.title];
            };   
            var linksFilter = linksFilter || function() {
                    return true;
            };         
            var links = $('.div a');                      
            var length,i = 0,
            filteredLinks = $.grep(links, function(el, i) {
                  return linksFilter.call(el, i);
            });   
            for (length = filteredLinks.length; i < length; ++i){                                      
                 filteredLinks[i] = linkMapper(filteredLinks[i], i);
            }                                   
            $.slimbox(filteredLinks, 2); //start position
 }); 
于 2013-05-20T09:17:52.717 回答