动态手风琴

时间:2012-07-18 13:50:57

标签: jquery dynamic refresh accordion

我对jQuery手风琴有疑问。

手风琴设置有点时髦。

看起来像这样:

手风琴标题
表格

手风琴标题
表格

手风琴标题
表格

我要做的是根据之前的表单输入更改Accordion标题(以及显示何时单击标题的信息)。 这是有效的,除了它确实显示为Accordion标题(所以基本上它失去了jQuery UI手风琴部分,只显示为与单击手风琴时通常会下拉的文本的链接)。

以下是一些代码:

在主html文档中

<script type="text/javascript">
    jQuery(function(){
    // Accordion
    //initialize accordion       

    jQuery("#jQueryUIAccordion").accordion({ 
        header: "h3",
        animated: "",
        event: "click",
        collapsible : true,
        autoHeight: false,
        navigation: true,
        active: false 
    }); 
    //set accordion header options
    jQuery("#jQueryUIAccordion").accordion("option", "icons",
      { 'header': 'ui-icon-triangle-1-e','headerSelected': 'ui-icon-info' });
    }); 
</script>

<div class="container fontClassBody paddingLeftBody">
    <div class="row">
        <div class="left">
            <div id="starting_type_in">
                <select name="Start" onchange="choiceStart(this.form);">
                    <option value=""></option>
                    <option value="Current Limit">Current Limit</option>
                    <option value="Soft Start">Soft Start</option>
                </select>
            </div>
        </div>
    </div>  
</div>

*这是需要根据以上内容进行更改* * **

<div>
    <div id="current_torque"><h3><a href="#">Torque/Current %</a></h3>
        <div>This represents the level of current that will be allowed during the start.This is only active when a current limit mode is selected and is programmable as allowed by the product selected. 
             Since most designs are based in historical references the best place to start an analysis is with 350% current limit, which produces a torque equivalent to a star-delta type historical reduced voltage starting method.
        </div>
    </div>
</div>

* 这是表单输入更改下一个手风琴标题的方式(在单独的javascript文件中) ** * *

function setCurrentTorque() {
    var cur_trq = "";
    if (start_type === "Current Limit") {
        cur_trq = "<h3><a href='#'>Initial Current %</a></h3><div>This represents the level of current that will be allowed during the start. This is only active when a current limit mode is selected and is programmable as allowed by the product selected. Since most designs are based in historical references the best place to start an analysis is with 350% current limit, which produces a torque equivalent to a star-delta type historical reduced voltage starting method. </div>"; 
     } else if (start_type === "Soft Start") {
     cur_trq = "<h3><a href='#'>Initial Torque %</a></h3><div>This represents the initial level of torque that will be applied to the motor at zero speed. This value will increase as the voltage is ramped during the start time. This value is only active when a soft start mode is selected and is programmable as allowed by the product selected. A default setting of around 70% is a good place to start with the estimation.</div>";
     } else {
     cur_trq = "<h3><a href='#'>Torque/Current %</a></h3><div> Initial Current %: <br />This represents the level of current that will be allowed during the start. This is only active when a current limit mode is selected and is programmable as allowed by the product selected. Since most designs are based in historical references the best place to start an analysis is with 350% current limit, which produces a torque equivalent to a star-delta type historical reduced voltage starting method.<br /><br /> Initial Torque %: <br />This represents the initial level of torque that will be applied to the motor at zero speed. This value will increase as the voltage is ramped during the start time. This value is only active when a soft start mode is selected and is programmable as allowed by the product selected. A default setting of around 70% is a good place to start with the estimation.</div>"; 
    }
     document.getElementById('current_torque').innerHTML = cur_trq;
    }
}

我希望这个足够的信息可以帮助你解决问题。我想我想我正在尝试做一些jQuery刷新,但我不知道如何实现这一点,试图照顾以前的实习工作,我从来没有使用过jQuery直到现在。

非常感谢,

randomtechdude

0 个答案:

没有答案
相关问题