我试图弄清楚如何在生成动态显示的图像后显示 yoxview,我正在做的是,我有一个 GridView,当用户点击产品时它会显示产品,它会动态生成在 yoxview 中显示的脚本,然后注册一个脚本加载事件。页面加载后,yoxview 显示在 div 选项卡中,这不是我想要的,我需要在页面完成加载后在 yoxview 中打开它。
<script type="text/javascript">
jQuery(document).ready(function () {
//jQuery('a[rel*=facebox]').facebox({
// loading_image: '/images/fb/loading.gif',
// close_image: '/images/fb/closelabel.gif'
//});
jQuery(".thumbnails").yoxview({
renderInfoPin: false
});
});
</script>
<div id="yoxview" class="thumbnails">
<div class="div_separator_10">
</div>
<asp:Image Visible="false" CssClass="product_thumbnail" ImageUrl="~/images/products/nophoto.gif"
ID="imgEmpty" runat="server" ImageAlign="AbsMiddle" />
<div class='captionwrapper'>
<asp:PlaceHolder ID="phImages" runat="server" ClientIDMode="Static"></asp:PlaceHolder>
<div class='captiondescription'>
<div class='captiondescription_content'>
<asp:Literal ID="lblImageInfo" runat="server"></asp:Literal>
</div>
</div>
</div>
</div>
protected void LoadMultipleImages(string productName, List<string> images)
{
var builder = new StringBuilder();
var builder2 = new StringBuilder();
builder.Append("jQuery(document).ready(function(){jQuery('#yoxview').yoxview({renderInfoPin: false, images: [");
if (images.Count > 0)
{
lblImageInfo.Text = string.Format("{0} more image(s) available", images.Count);
}
foreach (var image in images)
{
builder.AppendFormat("{{ media: {{ src: '{0}', title: '{1}' }}}},", image, productName);
}
builder.Append("]});});");
//builder.Append("jQuery('#yoxview').yoxview('open');");
//builder.Append("jQuery('#yoxview').click();");
//builder.Append("document.getElementById('phImages').click();");
//builder2.Append("document.getElementById('lnkProductImage').click();");
//builder2.Append("jQuery('#lnkProductImage').click(function(event){return;});");
ScriptManager.RegisterStartupScript(Page, typeof(string), "onLoadCall", builder.ToString(), true);
//ScriptManager.RegisterStartupScript(Page, typeof(string), "onLoadCall", builder2.ToString(), true);
}