简体   繁体   English

如何防止Cufon在子菜单中继承?

[英]How can I prevent Cufon from being inherited in submenus?

I am trying to have cufon render fonts in the top level of a UL/LI menu structure. 我正在尝试在UL / LI菜单结构的顶层使用cufon渲染字体。 How can I prevent cufon from rendering fonts or inheriting the style in the submenus. 如何防止cufon渲染字体或继承子菜单中的样式。

I have added a class to the top menu level only, 'top', and a separate class for all submenus, 'sub'. 我仅在顶部菜单级别中添加了一个类“ top”,并为所有子菜单“ sub”添加了一个单独的类。

I would really like to have cufon disabled for the submenus, but if that can't be done, then loading another font and restyling would be acceptable also. 我真的很想为子菜单禁用cufon,但是如果不能这样做,那么加载另一种字体并重新设置样式也是可以接受的。 I have tried both methods, but the inheritance is very persistent. 我已经尝试了两种方法,但是继承是非常持久的。

Here's the cufon code: 这是cufon代码:

Cufon.replace("li.top:not(li.top>ul>li.sub)", { fontFamily: "SerpentineDBol", 
                        //hover: true, 
                        hover: {
                          textShadow: '1px 1px #febf00',
                          color: '-linear-gradient(black, lightgray)'
                        },
hoverables: { li: true }, textShadow: "1px 1px white", color: "-linear-gradient(black, lightgray)" });
Cufon.replace("li.top>ul>li.sub", {fontFamily: "Arial Black" });

and the menu format here: 和菜单格式在这里:

<nav class="isi-nav clearfix">
    <div class="isi-nav-inner">
       <ul class="isi-hmenu" id="topmatt">
          <li class="item-464 active top">
             <a class=" active" href="/j25/">Home</a>
           </li>
           <li class="item-444 deeper parent top">
             <a href="/j25/index.php/sample-sites">Sample Sites</a>
             <ul>
               <li class="item-545 sub">
                 <a href="/j25/index.php/sample-sites-2/banner-module">Banner Module</a>
               </li>
               <li class="item-546 sub">
                 <a href="/j25/index.php/sample-sites-2/archive-module">Archive Module</a>
               </li>
              </ul>
             </li>
             <li class="item-476 top">
                <a href="/j25/index.php/captcha">Captcha</a>
             </li>
            </ul> 
        </div>
    </nav>

In the cufon code, I have tried defining a different font style for the 'sub' class, but it is being over ridden by the upper level 'top' style. 在cufon代码中,我尝试为'sub'类定义不同的字体样式,但是它被上层的'top'样式所覆盖。 Any ideas ? 有任何想法吗 ?

I figure out what I had to do to prevent the sub level UL to not be set through cufon. 我想出了要防止未通过cufon设置子级别UL的措施。 I did not need to use the complicated 我不需要使用复杂的

li.top:not(li.top>ul>li.sub) . li.top:not(li.top>ul>li.sub)

I just needed to designate the .top class by itself and then add 我只需要自己指定.top类,然后添加

ignore: { ul: true }, 忽略:{ul:true},

to the cufon settings and it disregarded the rest of the menu items. 到cufon设置,而忽略了其余菜单项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM