jquery - FancyBox - 单击时交换图像
问题描述
单击缩略图时,FancyBox 会放大该图像,但我想做的是将被放大的图像替换为另一个图像。
<map>
<area shape="poly" coords="453,862,477,862,478,899,453,900" href="/Images/main.jpg" alt="333" />
</map
$('area').fancybox({
beforeLoad: function(instance){
//change href to something like "/Images/main_333.jpg"
// the idea is to grab the alt tab number and then add it to the href string to get the correct image
}
});
解决方案
以下是如何更改 URL 的示例:
$('[data-fancybox="images"]').fancybox({
beforeLoad : function(instance, current) {
current.src = 'https://loremly.com/640x480/';
}
});
推荐阅读
- c# - Raspberry Pi 恒温器上的 C# 内存泄漏
- c++ - 可变参数上的奇怪值和覆盖文本
- r - 如何使用管道与预测对象一起列出?
- sql - 如果满足条件,sql查询以排除结果
- node.js - npx create-react-app 中止安装节点失败
- c# - 如何使用此光线投射来激活交互脚本?
- python - 将自引用从一种方法传递到另一种方法错误
- xamarin - Xamarin Forms Android 应用的“我们检测到此应用使用了不受支持的 Play 计费版本”
- react-router - 刷新后直接重定向时,React 路由器卡在某些路由上
- javascript - 使用 Markdown 语言中的 javascript 实现嵌套下拉常见问题解答