手动打开nyroModal库



阅读文档后,我用以下代码手动调用打开url(图像)

$.nmManual(this.href);

但现在我想手动调用nyroModal画廊过滤器,但到目前为止没有任何运气。我试图在.nmManual()回调中推送过滤器gallery,但它什么也没做。

我通过手动调用处理了这个需求,并使用了这个解决方法:

<div style="display:none;">
<?php $i=0; ?>
<?php foreach ($Gallery as $item): ?>
<?php if ($item->hasPhoto()): ?>
<a id="photo<?php echo $i ?>" href="<?php echo $item->getRelativePhotoPath() ?>" class="photo_gallery" title="<?php echo $item->getCaption() ?>" rel="gal"></a>
<?php $i++; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
$(document).ready(function() {   
    // #photo_gallery is the css selector of the anchor link used to start the gallery
    if ($('#photo_gallery').length != 0 && $('.photo_gallery').length != 0)
    {
        $('.photo_gallery').nyroModal();        
        $('#photo_gallery').click(function(e) {
            e.preventDefault();     
            $('#photo0').click();
        });
    }  
});

我希望这能帮助你。

最新更新