Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更改手风琴箭头位置_Javascript_Css_Jquery Mobile - Fatal编程技术网

Javascript 更改手风琴箭头位置

Javascript 更改手风琴箭头位置,javascript,css,jquery-mobile,Javascript,Css,Jquery Mobile,我是jquery Mobile的新手。我创造了一个手风琴,但我希望它的箭头出现在右边。 有人能帮我吗 下面是我的代码 <div class="accordion" id = "accordion"> </div> 然后我把我的手风琴装上了数组 for (i=0;i<names.length;i++) { var newDiv = "<h3>"+names[i]+"</h3><p>"

我是jquery Mobile的新手。我创造了一个手风琴,但我希望它的箭头出现在右边。 有人能帮我吗

下面是我的代码

<div class="accordion" id = "accordion">

</div>
然后我把我的手风琴装上了数组

for (i=0;i<names.length;i++)
  {               
      var newDiv = "<h3>"+names[i]+"</h3><p>"+subnames[i]+"</p>";
       $('.accordion').append(newDiv)
       $('.accordion').accordion("refresh");

}

for(i=0;i我认为类似于您得到的东西应该有用:

.accordion h3 a .ui-icon {
    float:right
}
请确保在jQM CSS之后执行或加载自定义CSS。您也可以尝试!重要语句:

.accordion h3 a .ui-icon {
    float:right !important;
}

在jQuery Mobile可折叠小部件中,您可以设置
data iconpos=“right”
将图标移动到右侧:

    <div data-role="collapsibleset" data-theme="a" data-content-theme="a">
        <div data-role="collapsible" data-iconpos="right">
             <h3>Section 1</h3>

            <p>I'm the collapsible content for section 1</p>
        </div>
        <div data-role="collapsible" data-iconpos="right">
             <h3>Section 2</h3>

            <p>I'm the collapsible content for section 2</p>
        </div>
        <div data-role="collapsible" data-iconpos="right">
             <h3>Section 3</h3>

            <p>I'm the collapsible content for section 3</p>
        </div>
    </div>

第一节
我是第一节的可折叠内容

第二节 我是第2节的可折叠内容

第三节 我是第3节的可折叠内容

这里有一个

对于动态添加的内容:

   var thedynamiccontent = '<div data-role="collapsible" data-iconpos="right"><h3>Another Section</h3><p>Hello from dynamic added section</p></div><div data-role="collapsible" data-iconpos="right"><h3>Another Section 2</h3><p>Hello from dynamic added section 2</p></div>'; 
   $("#accordion").append(thedynamiccontent).collapsibleset("refresh").enhanceWithin();
var thedynamiccontent='另一节Hello from dynamic added Section

另一节Hello from dynamic added Section 2

'; $(“#手风琴”).append(thedynamiccontent).collapsableset(“刷新”).enhanceWithin();
动态

注意:您还可以更改使用的图标:
数据折叠图标=“arrow-r”数据扩展图标=“arrow-u”
这对我来说很有效。


发布你的CSS和一些HTML正文{背景色:#333333;。手风琴H3A{宽度:50%}。手风琴H3A.ui图标{float:right}这与jQM无关。请澄清您的问题。
   var thedynamiccontent = '<div data-role="collapsible" data-iconpos="right"><h3>Another Section</h3><p>Hello from dynamic added section</p></div><div data-role="collapsible" data-iconpos="right"><h3>Another Section 2</h3><p>Hello from dynamic added section 2</p></div>'; 
   $("#accordion").append(thedynamiccontent).collapsibleset("refresh").enhanceWithin();
.ui-accordion .ui-accordion-header .ui-icon { 
    position: absolute; 
    left: 100%; 
    margin-left: -30px; 
    top: 50%; 
    margin-top: -8px; 
}
.ui-accordion-icons .ui-accordion-header a { 
    padding-left: 1em; 
}