- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
简介:
我正在使用本地安装的 WordPress 的高级响应式主题。
主题提供了一个基于 jQuery 1.11.0 的 Accordion ShortCode。
问题:
通过我在 ShortCode 中内联添加的 12 点列表,移动用户需要做一些向上滚动手势才能到达页面顶部以关闭冗长的 Accordion 项目,以便腾出空间来查看其他 Accordion 导航选项。
目标:
为了改进可访问性,我想通过在每个冗长的 Accordion 项目底部添加“关闭”链接来自定义 HTML 和 jQuery。
问题:
我无法获得额外的 <div id="close-title" class="close-title">CLOSE ^^</div>
放置在每个 Accordion 项的底部时起作用。
我尝试解决这个问题:
我添加了一个名为“closer
”的变量' 到打开的 jQuery 函数,这似乎在 DIV 元素与 CSS 类 .close-title
时起作用嵌套在类 .toggle-title
中. Accordion 函数的片段:
/* ACCORDION
/*====================================================================*/
(function($){
$('.accordion').each(function(){
var $this = $(this),
title = $this.find('.toggle-title'),
closer = $this.find('.close-title'),
content = $this.find('.toggle-content');
if($this.hasClass('collapsible-yes')){
$this.find('.active:not(:first)').removeClass("active");
}
....
....
事实上,类.close-title
的DIV元素行为与 .toggle-title-header
完全相同当嵌套在类 .toggle-title
中时,这很好地表明我在正确的轨道上。
当我说“行为”时,我指的是标题选项卡的功能方式及其“+”和“-”,它们是打开和关闭状态的指示器,每个 Accordion 项目打开和关闭点击。
我相信 jQuery 脚本似乎无法找到类为 .close-title
的 DIV 元素当它嵌套在 DIV 元素以外的任何地方时 .toggle-title
.
注意:请参阅 Accordion with Title: 'Trustee role description' in JSBin example 以查看此嵌套相关点的演示。
我的问题:
如何通过单击“关闭”调用用于切换每个菜单项的相同函数,以及如何通过放置 <div id="close-title" class="close-title">CLOSE ^^</div>
来实现此目的在 Accordion 项目的底部?
JSBin 示例:
我有这个 JSBin 示例:http://jsbin.com/yonox/2/edit - 你会注意到一个带有 id 和类的 DIV 元素:.close-title
.嵌套在评论 <!--START ACCORDION TAB 3-->
的顶部和底部.放在顶部的 DIV 有效,底部的 DIV 无效。
有人可以演示我如何使这个元素以与“标题 +/-”元素相同的方式切换项目,因为理想情况下,这个元素应该位于每个 Accordion 项目的底部。
为了我们的信息,这里是 Accordion 菜单的原始短代码的片段:
[accordion collapsible="yes no"]
[toggle title="What do I need to know if I’m thinking of becoming a trustee?" open="no"]
Charity Trustees are responsible for controlling the management and administration of the charity. In general terms trustees are responsible for the proper administration of the charity in accordance with the law, and its trusts as set out in the governing document.
Their overriding duty is to pursue the objectives of the charity and ensure that income and property are used exclusively for these objectives.
The general duties of a trustee are set out in the common law and statute.
[/toggle]
最佳答案
这种问题有很多解决方案,我试图列出的解决方案之一,就这样
在冗长的 toggle-content div 中添加一个 close me div 作为:
<div class="close-me" style="color:red;">Close Me ^ </div>
注意:请确保您已将此 close me div 插入到您的 toggle-content div 中,并且必须是 toggle-content div 的最后一个子元素。
并在您的 java 脚本文件末尾添加以下内容:
$('.close-me').click(function(){
$(this).parent('div.toggle-content').prev().click();
});
我希望这些解决方案可以解决您的问题。
关于jquery - 改善辅助功能 : Customising Accordion jQuery and HTML?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24170892/
我有两个可以相互交换数据的列表。我的列表之一是 Accordion 列表,您可以在其中放置数据,但也包含更多特定的 Accordion ,这些 Accordion 也允许在其中放置数据。我可以在表之间
我正在从数据库中获取记录,我必须在 Accordion 中显示这些记录。我能够显示记录。现在我正在做的是,我必须显示第一个打开的 Accordion ,然后在单击然后关闭上一个打开的 Accordio
我有一个 Accordion ,我希望具有以下功能:当用户单击链接展开时,其他展开的链接(如果有)将折叠。我知道这个功能是内置在 Accordion 插件中的,但我试图避免添加另一个库(jQuery
有点奇怪,这个。我有两个 jquery Accordion 实体,在点击一个 Accordion 中的一个项目时,我想将它动态添加到第二个 Accordion 中,并将其隐藏在原件中。 目前从 A 移
我尝试了以下代码,除了 FontAwesome 图标之外,一切都很好。我尝试在 Google 上寻找解决方案,但找不到我正在寻找的解决方案。 当我单击其中一个 Accordion 时,另一个 Acco
我正在使用 Bootstrap 制作一个响应式网站,它包含带有大量文本的嵌套 Accordion ,当您读到底部并单击下一个 Accordion 时,大量文本被折叠,我留在了页面底部。 我从 Boot
尝试创建嵌套 Accordion 时,是否可以使用 jquery 在另一个 Accordion 内部创建 anchor 链接和 Accordion ? 例如,在我的代码中我有 用于 Accordion
我正在实现一个嵌套 Accordion ,但是当我点击父级 Accordion 中的子组件时,它关闭了父级。我希望它在点击 child 时保持打开状态。 HTML: Home
我试图在 bootstrap Accordion 中添加加号和减号,当显示内容的 div 打开时显示加号,关闭时显示减号,当我打开第二个选项卡时它应该关闭其他打开的选项卡的内容(这个当前正在发生)并且
我有 Angular 5 应用程序,我正在使用 PrimeNG 组件。我创建了带有定义标题的 PrimeNG Accordion ,其中有标题和一些操作按钮,如下所示:
我有一个运行正常的Bootstrap 3.0 Accordion ,当您单击其中一个主链接时,该 Accordion 将打开。唯一的问题是,如果您单击第二个主链接,则第一个链接不会折叠-它们都保持打开
我正在尝试将 Accordion 嵌入另一个 Accordion 中,但是它不起作用,嵌入式 Accordion 只会扩展到第一个扩展 Accordion 的大小,我需要添加额外的空间才能显示内容,任
我正在尝试将 Accordion 放在 Accordion 中。但是第二个 Accordion 不能正常工作。第一个中的 Accordion 根本不起作用。任何帮助将不胜感激 :) 我的问题主要是代码
我正在尝试创建一个交互式 Accordion / Accordion /折叠动画,以便 View 在与交互时折叠/展开自身 - 以相同的方式 flipboard折叠 View ,但两侧都折叠 我认为我
您好,这是我的第一个问题,英语不是我的母语,如果我犯了一些错误,请见谅。 我在我的项目中使用 Angular 6、jQuery 和 BS。 我有两个 Accordion ,每个都有不同的类别。我们将它
我正在构建一个非常简单的 Accordion ,我想设置 ti 在页面加载时打开所有容器。让它打开单个项目(或没有项目)是没有问题的,但我怎样才能让它打开页面加载时的所有项目。 HTML
我正在处理一个刚刚添加了 Accordion 的页面。它有几个不同的 Accordion ,当单击其中任何一个时,所有 Accordion 都会打开。再次单击 Accordion 时,它应该折叠,但它
尝试弄清楚如何在 Dojo 的 Accordion dijit.layout.Accordion 容器上添加展开/折叠箭头图像,就像 dijitTitlePane / dojox.widget.Tit
我有一个 Accordion ,其中包含一些嵌套的 Accordion ,我打算将其用于移动导航。我不是最擅长 JavaScript,所以我必须找到教程才能达到现在的水平。我现在需要的只是当其他 Ac
我基本上试图关闭所有 Accordion ,只打开其中一个被单击的 Accordion 。 因此,短期内只打开一个选项卡。 这是我到目前为止所拥有的: https://jsfiddle.net/gym
我是一名优秀的程序员,十分优秀!