CufonがjQueryでAddclass関数を許可しないのはなぜですか?
-
23-09-2019 - |
質問
男、私はそれを手に入れません。私は4セットのペアリンクを持っています。そこでは、一方のセットを上にホバリングすることにより、他のセットをオフにします。私はそれをjqueryで働いていますが、私がキュフォンを追加するとき、それはサイコロではありません。これが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に関連するほとんどのCufonの問題は、すべてが呼ばれる順序にまで及んでいることを知る前に、実際に自殺しました。ドキュメントで彼らの説明を見つけるのに苦労しています。去年の9月がわかったので、私は今私の答えを引用することができないことを恐れています。仕事に戻らなければなりません。基本的に、Cufonは最初に並ぶのが好きで、Jqueryは通常、Shotgunに乗ることができます。例えば;
これは またはできる 悪くなる :
<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>
違いに注意してください。Cufon周辺の2回目は、jQuery機能の前に処理されます。
このソリューションは、私がすでにjqueryで走っていたもののために、Cufonが完全に何でも置き換えることを拒否した場所で私に役立ちました。あなたの問題が同じ問題の学校から来ることができるかどうかはわかりません...
関数を呼び出す必要がありますcufon.refresh();イベント後。https://github.com/sorccu/cufon/wiki/api私は同じ問題を抱えていましたが、この方法は私のために働きました。