开发者

How to call lightbox from outstanding link?

Does somebody know, how to call a lightbox from an custom link?

Example:

$('#price1 a').lightBox(); //in 开发者_StackOverflowthe header

Now I want to click a custom link somewhere on the page.

<a href="#" class="price1">Link to lightBox</a>

And images in a div (until link clicked they are not visible)

<div id="price1" style="display: none;">
    <a href="../images/img1.jpg"></a>
    <a href="../images/img2.jpg"></a>
    <a href="../images/img3.jpg"></a>
</div>  

Could somebody please help.

Best Regards!


You can try jQuery events binding:

$(".price1").bind("click", function() {
    $("#price1 a:first").click();
};

This way, when you click on link with class "price1", jQuery will emulate clicking on first link in div with id "price1".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜