CUFON为什么不允许使用jQuery的addClass函数?
-
23-09-2019 - |
题
伙计,我只是不明白。我有四组配对链接,通过将一组悬停在另一组上。我可以在jQuery工作,但是当我添加cufon时,这不是骰子。这是JQ脚本:
<script type="text/javascript">
jQuery(document).ready(function() {
var doubleHighlight = function(element1, element2, class) {
element1.hover(
function() {
element2.addClass(class);
},
function() {
element2.removeClass(class);
}
);
element2.hover(
function() {
element1.addClass(class);
},
function() {
element1.removeClass(class);
}
);
};
doubleHighlight(jQuery("#abouttop"), jQuery("#aboutbottom"), "highlight_about");
doubleHighlight(jQuery("#worktop"), jQuery("#workbottom"), "highlight_work");
doubleHighlight(jQuery("#blogtop"), jQuery("#blogbottom"), "highlight_blog");
doubleHighlight(jQuery("#contacttop"), jQuery("#contactbottom"), "highlight_contact");
});
</script>
这是Cufon的部分:
<script src="cufon-yui.js" type="text/javascript"></script>
<script src="gothamxlight_300-gothamxlight_300.font.js" type="text/javascript"> </script>
<script src="gothamlight_300-gothamlight_500.font.js" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('#type', { fontFamily: 'gothamxlight', hover: true});
Cufon.replace('#smalltype', { fontFamily: 'gothamlight', hover: true});
Cufon.replace('#nav', { fontFamily: 'gothamlight', hover: true});
</script>
有任何想法吗?也许Cufon如何呈现文字?需要刷新吗?我在这里抓住稻草。
没有正确的解决方案
其他提示
Cufon不起作用的问题还是Cufon打破了您的双重灯光?
我实际上在发现大多数与jQuery有关的问题都归结为所有事物所谓的命令。我很难在文档中找到他们对此的解释,因为去年9月我发现了,所以我现在无法引用我的答案,我必须重新上班。基本上,Cufon喜欢排名第一,JQuery通常很乐意骑shot弹枪。例如;
这是 或可以 坏 :
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="cufon-yui.js"></script>
<script type="text/javascript">
your.jQueryKungFu(function() {
};
</script>
<script type="text/javascript">
cufon.replace('h1');
</script>
这很好:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="cufon-yui.js"></script>
<script type="text/javascript">
cufon.replace('h1');
</script>
<script type="text/javascript">
your.jQueryKungFu(function() {
};
</script>
注意差异,在jQuery函数之前处理第二次CUFON。
该解决方案为我服务了,因为我已经使用jQuery运行的是,Cufon拒绝拒绝更换任何东西。我不确定您的问题是否可能来自同一问题学校...
您需要调用函数cufon.refresh();事后。https://github.com/sorccu/cufon/wiki/api我也有同样的问题,这种方法对我有用。
不隶属于 StackOverflow