jquery-ui 手风琴内的链接
我在 jquery-ui 手风琴 div 的内容中有一个链接。它可以工作,但格式与我的其他链接不同。我在 jquery-ui 手风琴页面 上找到了这个:
如果您在手风琴内容中有链接并使用 a 元素作为标题,请向它们添加一个类并将其用作标题,例如。标头:'a.header'。
但是,我不太确定该怎么做。我假设我需要更改手风琴的 .css 以使用这个新的 a.header 类作为标题,然后我的常规 a
元素将使用其余 a< 的 css我的网站上的 /code> 元素使用了什么?
这是手风琴的 .css:
/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
/* IE7-/Win - Fix extra vertical space in lists */
.ui-accordion a { zoom: 1; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
I have a link within the content of a jquery-ui accordion div. It works, but is not formatted like the rest of my links. I found this on the jquery-ui accordion page:
If you have links inside the accordion content and use a-elements as headers, add a class to them and use that as the header, eg. header: 'a.header'.
However, I'm not really sure how to do this. I assume I need to change the .css for the accordion to use this new a.header class for the headers and then my regular a
elements will use the css that the rest of the a
elements on my site use?
Here's the .css for the accordion:
/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
/* IE7-/Win - Fix extra vertical space in lists */
.ui-accordion a { zoom: 1; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用像 firebug 这样的东西来检查你的元素。从那里您可以准确地找出 CSS 的哪一部分正在影响您的链接,以便您可以这样设计它。或者为链接提供自己的类名称,以按照您想要的方式设置其样式。如果您想直接进入 jquery UI CSS,也许可以研究一下其中包含“a”的标签样式,看看这是否能让您到达任何地方。
即:
那些
I recommend using something like firebug to inspect your element. From there you can figure out exactly what part of that CSS is affecting your link so you can style it that way. That or give the link its own class name to style it the way you want. If you want to go directly to the jquery UI CSS, perhaps look into styling the tags with 'a' in them and see if that gets you anywhere.
ie:
those ones
您可以更改标头以使用标签以外的其他内容,然后在创建手风琴时设置属性:
You can change your headers to use something other than an tag and then set the property when you're creating the accordion:
我有一个网站需要执行此操作,我使用下面的代码来区分手风琴中的链接和标题:
标记:
JQuery:
I have a website where I need to do this and I use the code below to accomplish differentiating between links and headers in the accordion:
Markup:
JQuery: