Php Pinterest小部件与jquery选项卡冲突
我试图使用jQuery将Pinterest小部件放到我网站的选项卡中,但它不显示任何内容。然而,当我把它放在标签外时,它就工作了 我正在使用以下jQuery代码:Php Pinterest小部件与jquery选项卡冲突,php,javascript,jquery,widget,pinterest,Php,Javascript,Jquery,Widget,Pinterest,我试图使用jQuery将Pinterest小部件放到我网站的选项卡中,但它不显示任何内容。然而,当我把它放在标签外时,它就工作了 我正在使用以下jQuery代码: <script="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document)
<script="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
});
</script>
$(文档).ready(函数(){
//默认动作
$(“.tab_content”).hide();//隐藏所有内容
$(“ul.tabs li:first”).addClass(“active”).show();//激活第一个选项卡
$(“.tab_content:first”).show();//显示第一个选项卡内容
//点击事件
$(“ul.tabs li”)。单击(函数(){
$(“ul.tabs li”).removeClass(“active”);//删除任何“active”类
$(this).addClass(“active”);//将“active”类添加到所选选项卡
$(“.tab_content”).hide();//隐藏所有选项卡内容
var activeTab=$(this).find(“a”).attr(“href”);//查找rel属性值以标识活动选项卡+内容
$(activeTab).fadeIn();//淡入活动内容
返回false;
});
});
这是Pinterest的(第二行正好位于body标签上方,如说明所示):
这是选项卡代码
<ul class="tabs">
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content"><h2>Tab 1</h2><p>Content </p></div>
<div id="tab2" class="tab_content"><h2>Tab 2</h2><p><a data-pin-do="embedUser" href="http://pinterest.com/thisismycyprus/"></a></p></div>
</div>
表1内容
表2
您已经在$(窗口).load(函数(){})中添加了脚本代码>
检查
//
您已经在$(窗口).load(函数(){})中添加了脚本代码>
检查
//
我的答案是关于Pinterest/JQuery(不是JQuery选项卡)
我不得不在幻灯片中使用Pinterest提要小部件(),我得到了相同的错误:当div容器为display:none时代码>页面加载时,Pinterest内容为空
我使用可见性:隐藏相反,在我的div容器上,初始化我的幻灯片(在开始之前等待4秒),设置display:none;能见度:可见然后我可以使用JQueryshow()代码>/隐藏()代码>我的答案是关于Pinterest/JQuery(不是JQuery选项卡)
我不得不在幻灯片中使用Pinterest提要小部件(),我得到了相同的错误:当div容器为display:none时代码>页面加载时,Pinterest内容为空
我使用可见性:隐藏相反,在我的div容器上,初始化我的幻灯片(在开始之前等待4秒),设置display:none;能见度:可见然后我可以使用JQueryshow()代码>/隐藏()代码>您可以同时包含选项卡的标记吗?您可以同时包含选项卡的标记吗?
<ul class="tabs">
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content"><h2>Tab 1</h2><p>Content </p></div>
<div id="tab2" class="tab_content"><h2>Tab 2</h2><p><a data-pin-do="embedUser" href="http://pinterest.com/thisismycyprus/"></a></p></div>
</div>
//<![CDATA[
$(window).load(function(){
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
});//]]>