печень Демо:https://tornhq.com/WorkingOn/InteractiveMap/Replaced-With-Divs.htmlРазбитого JQuery Tab Switcher
JQuery Tab Переключить кодигнорировать линии 2-6
$(function() {
$("#clickme").toggle(function() {
$(this).parent().animate({right:'-300px'}, {queue: false, duration: 500});
}, function() {
$(this).parent().animate({right:'-0px'}, {queue: false, duration: 500});
});
$('#tab-content div').hide();
$('#tab-content div:last').show();
$('#Info-Side-Tabs li').click(function() {
$('#Info-Side-Tabs li').removeClass("current");
$(this).find('li').addClass("current");
$('#tab-content div').hide();
var indexer = $(this).index(); //gets the current index of (this) which is #nav li
$('#tab-content div:eq(' + indexer + ')').fadeIn(); //uses whatever index the link has to open the corresponding box
});
});
У меня возникли проблемы, реализующий вкладку JQuery переключатель в мой веб-сайт:
"$(this).find('li').addClass("current");"
используется найти «a», однако мне нужно, чтобы он изменил класс li, а не a.
Единственное отображаемое содержимое переключателя табуляции является частью второго сверху, а не всего. Я просто очень смущен в этот момент времени и действительно могу с некоторой помощью справиться.
Update:
$('#Info-Side-Tabs li').removeClass("current");
Seems to be removing the class upon clicking, however
$(this).find('li').addClass("current");
Does not seem to add the class to the new clicked tab.
$("#tab-3").toggle(function() {
// $('#Map-Selection-Info').animate({right:'-976px'}, {queue: false, duration: 500});
$('#Map-Selection-Info').animate({marginLeft: '976px'}, 1000).addClass('current');
}, function() {
$('#Map-Selection-Info').animate({right:'670px'}, {queue: false, duration: 500});
});
I am trying to apply the above to the 'Hide This' tab, so when you click on it, it move further right out of view and recliick to show.
Full Script So Far:
$(function() {
$("#tab-3").toggle(function() {
// $('#Map-Selection-Info').animate({right:'-976px'}, {queue: false, duration: 500});
$('#Map-Selection-Info').animate({marginLeft: '976px'}, 1000).addClass('current');
}, function() {
$('#Map-Selection-Info').animate({right:'670px'}, {queue: false, duration: 500});
});
$('#tab-content div').hide();
$('#tab-content div:last').show();
$('#Info-Side-Tabs li').click(function() {
$('#Info-Side-Tabs li').removeClass("current");
$(this).find('li').addClass("current");
$('#tab-content div').hide();
var href = $(this).find('a').attr("href");
$('#tab-content div' + href).fadeIn().find('*').show();
});
});
Проверьте свои изменения, вы до сих пор не имеют некоторые из последних изменений. Также функция переключения не работает, поскольку нет элемента с идентификатором tab-3! Вам нужно указать элементу li идентификатор tab-3. –
@ Айдын Хассан. Теперь я дал id id tab-3, но движения все еще нет. Я прошел через то, что вы сказали, и я не могу понять, что я делаю неправильно. Живая версия теперь обновлена. С наилучшими пожеланиями, Тим – 2013-03-30 22:18:20
@ Айдын Хасан. Я не знаю, что я только что сделал, но теперь он почти работает правильно.Мой переполнение: скрыто; не работает, и я бы хотел, чтобы # tab-3 не переключал вкладку. – 2013-03-30 22:27:41