不要让手风琴使用js

时间:2014-03-21 12:55:19

标签: javascript php jquery html

我没有让手风琴在my page上工作:

<script type='text/javascript' src='http://mendert.nl/zeeuwseknop/wp-content/themes/food-cook/includes/js/jquery-ui-1.9.2.custom.js?ver=1.9.2'></script>
<script type='text/javascript' src='http://mendert.nl/zeeuwseknop/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script> 
<script type='text/javascript' src='http://mendert.nl/zeeuwseknop/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>

这是我的js

/*content accordion*/
$('.accordion').each(function(){
    var acc = $(this).attr("rel") * 2;
    $(this).find('.accordion-inner:nth-child(' + acc + ')').show();
    $(this).find('.accordion-inner:nth-child(' + acc + ')').prev().addClass("active");
});

$('.accordion .accordion-title').click(function() {
    if($(this).next().is(':hidden')) {
        $(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200);
        $(this).toggleClass('active').next().slideDown(200);
    } else {
        $(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200);
    }
    return false;
});

我通过我的php函数使用短代码在我的页面中插入:

// [container]
function accordion($atts, $content=null, $code) {

extract(shortcode_atts(array(
    'open' => '1',
    'title' => 'Title'
), $atts));

if (!preg_match_all("/(.?)\[(accordion-item)\b(.*?)(?:(\/))?\](?:(.+?)\[\/accordion-item\])?(.?)/s", $content, $matches)) {
    return do_shortcode($content);
} 
else {
    $output = '';
    for($i = 0; $i < count($matches[0]); $i++) {
        $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);

        $output .= '<div class="accordion-title"><a href="#">' . $matches[3][$i]['title'] . '</a></div><div class="accordion-inner">' . do_shortcode(trim($matches[5][$i])) .'</div>';
    }
    return '<h3 class="accordion_h3">'.$title.'</h3><div class="accordion" rel="'.$open.'">' . $output . '</div>';

}   

}`

1 个答案:

答案 0 :(得分:1)

可能你错过了这两个文件 - markerclusterer.js和favico.js(404错误),所以这些错误会阻挡你的手风琴。