我使用的是http://www.no-margin-for-errors.com的PrettyPhoto 3.1.4
我正在使用ASP.NET MVC3中的内容处理程序从数据库加载图像。Pretty Photo没有使用API加载图像。如何让它与内容处理程序一起工作?
下面是一张图片,它会弹出一个图片库:
<a href='' onclick="$.prettyPhoto.open(api_images0,api_titles0,api_descriptions0);" title='UFC123'>
<img style="max-height: 160px;max-width: 260px;" id='Img31' alt='UFC123' title='UFC123' src='/img.ashx?mediaId=31' style='padding:10px' />
</a>下面是我使用的脚本:
<script type="text/javascript" charset="utf-8">
var api_images0 = ['/img.ashx?mediaId=33'];
var api_titles0 = ['Gina'];
var api_descriptions0 = ['Gina Description'];
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$("a[rel^='prettyPhoto']").prettyPhoto({ theme: 'dark_rounded', social_tools: '' });
});
</script>发布于 2012-04-27 23:35:39
没有javascript错误。我想通了。问题是我需要井号而不是href标签的空字符串。
<a href='#' onclick="$.prettyPhoto.open(api_images0,api_titles0,api_descriptions0);" title='UFC123'>
<img style="max-height: 160px;max-width: 260px;" id='Img31' alt='UFC123' title='UFC123' src='/img.ashx?mediaId=31' style='padding:10px' />
</a>https://stackoverflow.com/questions/10336365
复制相似问题