gpt4 book ai didi

Jquery FancyBox 目标特定 DIV ID?

转载 作者:行者123 更新时间:2023-12-03 22:12:29 26 4
gpt4 key购买 nike

如何让 Fancy box 定位页面上的特定 DIV ID,而不是请求 fancybox 中的整个页面。?这是我的代码,所以票价

$(function() {

$(".style_image a").live('click', function(event) {

$(".style_image a").find("#show_style").fancybox();

});
});

这不起作用?

我最初尝试了以下方法:

 $(function() {

$(".style_image a").live('click', function(event) {

$(this.href + " #show_style").fancybox();

});
});

不确定这是如何完成的,或者是否可能?

here are the doc's

最佳答案

如果您希望 fancybox 打开某个 div,您只需使用以下简单步骤:

首先您需要一个链接来将 FancyBox Hook 到:

<a href="#myDivID" id="fancyBoxLink">Click me to show this awesome div</a>

记下 anchor 旁边的div id

其次,您需要一个将显示在 FancyBox 内的 div:

<!-- Wrap it inside a hidden div so it won't show on load -->
<div style="display:none">
<div id="myDivID">
<span>Hey this is what is shown inside fancybox.</span>
<span>Apparently I can show all kinds of stuff here!</span>
<img src="../images/unicorn.png" alt="" />
<input type="text" value="Add some text here" />
</div>
</div>

第三个是一些非常简单的 javascript 将它们连接在一起

<script type="text/javascript">
$("a#fancyBoxLink").fancybox({
'href' : '#myDivID',
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
</script>

关于Jquery FancyBox 目标特定 DIV ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2613025/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com