0

我有一个关于 jQuery Accordion 的问题。

手风琴的设置有点时髦。

看起来像这样:

手风琴头
表格件

手风琴头
表格件

手风琴头
表格件

我要做的是根据先前的表单输入更改 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。

非常感谢,

随机技术老兄

4

0 回答 0