これが私が使用しているスクリプトです。
$(window).load(function() {
$('#edifici, #artistici, #industriale, #fotovoltaico, #veterinaria, #architettonici').hide();
if (!!window.location.hash) {
var hash = window.location.hash;
var $content = $(hash);
showContent($content)
}
$('.home').click(function () {
var id = this.id.replace('mostra_', '');
var $content = $('#' + id + ':not(:visible)');
if ($('.current').length === 0) {
showContent($content)
} else {
$('.current').fadeOut(600, function () {
showContent($content)
});
}
});
function showContent(content) {
content.fadeIn(600);
$('.current').removeClass('current');
content.addClass('current');
}
});
このガイドに従って、WordPress(非競合モードでjQueryを使用)で使用するために、スクリプトを次のように変更しました
jQuery.noConflict();
jQuery(window).load(function($) {
$('#edifici, #artistici, #industriale, #fotovoltaico, #veterinaria, #architettonici').hide();
if (!!window.location.hash) {
var hash = window.location.hash;
var $content = $(hash);
showContent($content)
}
$('.home').click(function () {
var id = this.id.replace('mostra_', '');
var $content = $('#' + id + ':not(:visible)');
if ($('.current').length === 0) {
showContent($content)
} else {
$('.current').fadeOut(600, function () {
showContent($content)
});
}
});
function showContent(content) {
content.fadeIn(600);
$('.current').removeClass('current');
content.addClass('current');
}
});
残念ながら、正しく動作していないようです...何が間違っているのでしょうか?