jQuery和toggleClass问题

时间:2013-08-15 12:05:09

标签: javascript jquery

我遇到了一些javascript的问题。 基本上我已经创建了一个手风琴模块,但是,当手风琴滑开时我需要一个toggleclass来更改标题div的名称,我看了很多地方,但我似乎无法做到正确!

任何关于在哪里放置正确的javascript的帮助都会非常感激!

提前致谢!

这是我正在使用的JS:

function showslidey(id, el) { 
    /* Find out if the selector is MooTools or JQuery - It Matters! */
    if (typeof jQuery == "function") {
        // JQuery   
        jQuery('#linky' + id).slideDown()
    } else {
        // Mootools
        var VerticalSlide = new Fx.Slide('linky' + id);
        // We need to start by making sure the content is hidden - it defaults to display: none
        VerticalSlide.hide();
        $('linky' + id).setStyle('display', 'block');
        // Slide in the content
        VerticalSlide.slideIn();
    }
    el.setAttribute('onclick', 'hideslidey(' + id + ',this)');
}

function hideslidey(id, el) {
    if (typeof jQuery == "function") {
        // JQuery 
        jQuery('#linky' + id).slideUp()
    } else {
        // Mootools
        var VerticalSlide = new Fx.Slide('linky' + id);
        VerticalSlide.slideOut();
    }
    el.setAttribute('onclick', 'showslidey(' + id + ',this)');
}

这是我也得到的HTML:

<div class="header" onclick="showslidey(<?php echo $link->link_id; ?>,this)">
    <h3></h3>

echo "<div id='linky{$link->link_id}' style='display: none;'>"; 
    ?>

0 个答案:

没有答案
相关问题