0

I am using ColorBox library for a link inside a GridView row, but the colorbox don't show the popup window, but it redirect to the page.. If I took the same link to outside ,, it opens the colobox window .. why ?

The link to open the colorbox window :

<a id="ctl00_ContentPlaceHolder1_gvFSuper_ctl07_HyperLink1" href="AddStaff.aspx" class="showColorBox">Test</a>

javascript:

 jQuery(document).ready(function ($) {
        $(".showColorBox").colorbox({ iframe: true, innerWidth: 800, innerHeight: 400 });
    });
4

1 回答 1

0

在您尝试为其分配颜色框时,该链接是否存在于文档中?如果没有,您可能必须使用事件委托。例如:

$('document').on('click', '.showColorBox', function(e){
    $.colorbox({href: this.href, iframe: true, innerWidth: 800, innerHeight: 400})
    e.preventDefault();
});
于 2012-05-30T16:46:10.350 回答