[英]On click change tab
我一直在嘗試找出如何使用上一個標簽中的隨機<a href=""></a>
來更改一個標簽(定位另一個標簽)(我認為它的JQuery標簽)。
我目前擁有的是:
<a class="txt-bblue hover-u" href="#" onclick="$(".wpb_tabs").tabs( "active", "tab-1393763893-1-88" )">becoming a carer</a>
但它似乎無能為力。 我已經在網上和這些論壇上搜索了答案,但是建議的解決方案似乎不起作用。
選項卡的Js功能是:
/* Tabs + Tours
---------------------------------------------------------- */
if ( typeof window['vc_tabsBehaviour'] !== 'function' ) {
function vc_tabsBehaviour() {
jQuery(function($){$(document.body).off('click.preview', 'a')});
jQuery('.wpb_tabs, .wpb_tour').each(function(index) {
var $tabs,
interval = jQuery(this).attr("data-interval"),
tabs_array = [];
//
$tabs = jQuery(this).find('.wpb_tour_tabs_wrapper').tabs({
show: function(event, ui) {wpb_prepare_tab_content(event, ui);},
activate: function(event, ui) {wpb_prepare_tab_content(event, ui);}
}).tabs('rotate', interval*1000);
jQuery(this).find('.wpb_tab').each(function(){ tabs_array.push(this.id); });
jQuery(this).find('.wpb_tab a[href^="#"]').click(function(e) {
e.preventDefault();
if ( jQuery.inArray( jQuery(this).attr('href'), tabs_array) ) {
$tabs.tabs("select", jQuery(this).attr('href'));
return false;
}
});
jQuery(this).find('.wpb_prev_slide a, .wpb_next_slide a').click(function(e) {
e.preventDefault();
var ver = jQuery.ui.version.split('.');
if(parseInt(ver[0])==1 && parseInt(ver[1]) < 9) {
var index = $tabs.tabs('option', 'selected');
if ( jQuery(this).parent().hasClass('wpb_next_slide') ) { index++; }
else { index--; }
if ( index < 0 ) { index = $tabs.tabs("length") - 1; }
else if ( index >= $tabs.tabs("length") ) { index = 0; }
$tabs.tabs("select", index);
} else {
var index = $tabs.tabs( "option", "active"),
length = $tabs.find('.wpb_tab').length;
if ( jQuery(this).parent().hasClass('wpb_next_slide') ) {
index = (index+1) >=length ? 0 : index+1;
} else {
index = index-1 < 0 ? length -1 : index-1;
}
$tabs.tabs( "option", "active", index );
}
});
});
}
}
這是WP的Js_composer插件腳本
我頁面的鏈接是: http : //safercareltd.com/careers-training/jobs-vacancies/
對於我要去哪里的任何幫助將非常感謝
僅在您要打開的標簽上觸發click事件如何:
onclick="$('#ui-id-2').trigger('click');return false;"
嘗試:
$(function(){
$('a.txt-bblue.hover-u').on('click',function(){
$('.wpb_tab').trigger('click');
return false;
});
});
要么:
$(document).ready(function(){
$('a.txt-bblue.hover-u').on('click',function(){
$('.wpb_tab').trigger('click');
return false;
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.