【问题标题】:Change href by data jquery fancybox通过数据 jquery fancybox 更改 href
【发布时间】:2016-05-24 22:33:36
【问题描述】:

因为它可能会改变一个数据 llamdad 菜单/内容的键的 href 值,所以请举个例子让我理解:

默认情况下我们有这个:

<a class="fancybox" href="#test1">Test 1</a>

<div id="test1" class="hide">
  <img alt="" src=".../images/480x360-1.jpg" />
</div>

我寻求的工作是:

<span class="fancybox" data-menu="test1">Test 2</span>

<div data-content="test1" class="hide">
  <img alt="" src=".../images/480x360-1.jpg" />
</div>

链接: http://jsfiddle.net/1co3hcpx/1/

Fancybox 支持我的鼻子,如果那样做效果。

如果有人可以帮助我,我将不胜感激。谢谢

【问题讨论】:

    标签: jquery fancybox


    【解决方案1】:

    fancybox 工作基于 href 属性(注意:span 不应该有 href)作为解决方法我已将 href 添加到 span 标签
    你的 span 应该是这样的:

    <span class="fancybox" data-menu="test2" href="#test2">Test 2</span>
    

    这是一个工作版本 http://jsfiddle.net/1co3hcpx/4/

    【讨论】:

    • 如果这个想法是基于声明 2 至少在 html 中不修改但在 fancybox 中
    • 如果我是你,我不会冒险修改fancybox,最好破解你的html
    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    • 2019-12-03
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 2021-03-08
    相关资源
    最近更新 更多