帝国cms内容页图片添加灯箱效果,也是青青在使用帝国cms程序过程中经常会遇到的。下面是78模板网整理的关于本篇内容在“(帝国cms使用)”中的解决方案和思路,方便新手站长们在利用帝国cms建网站的时候,可以少走一些弯路。
js:
<script>
$(function () {
$('.content').find('img').each(function () {
var _this = $(this);
var _src = _this.attr("src");
var _alt = _this.attr("alt");
_this.wrap('<a data-fancybox="images" href="' + _src + '" data-caption="' + _alt + '"></a>');
$(this).attr('title','' + _alt + '');
})
})
</script>
外部引用文件(为避免地址失效,请下载文件后更改调用地址):
<!--fancybox-->
<link href="jquery.fancybox.css" rel="stylesheet">
<script src="jquery.fancybox.js"></script>
以上就是关于帝国cms调用教程中"帝国cms内容页图片添加灯箱效果"的全部内容,如果有遇到帝国cms调用教程其他问题的,可以在评论留言,或者加微信咨询。