Jquery FancyBox目标特定的DIV ID?

如何让Fancy框定位到页面上的特定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(); }); }); 

不确定这是怎么做的,或者甚至是否可能?

这是医生的

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

首先,您需要一个链接来将FancyBox挂钩到:

 Click me to show this awesome div 

注意锚点旁边的div id

其次你需要一个将在FancyBox中显示的div:

  
Hey this is what is shown inside fancybox. Apparently I can show all kinds of stuff here!

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

  

你只需要这个选择器:

 $("#show_style").fancybox(); 

ID选择器 (因为ID应该是唯一的)只是#IDGoesHere

认为你所追求的是在一些fancybox中加载内容,如果你想从href指向的页面加载say

,你可以使用.load()

 $(".style_image a").on('click', function(event) { $('#show_style').load(this.href + " #content").fancybox(); }); 

.load()有一个url selector选项,只加载目标页面的一部分。