テキストを独自のフォントに変換するためにcufonを使用しています。
問題は、テキストが逆に表示されることです。
という JavaScript ファイルを使用していますcunfonRTL.js
。内容は次のとおりです。
var CufonRTLClass=(function(){
this.RTL = RTL;
function RTL(tagName) {
$(tagName)/*.css('font-size', '19px')*/.wrapInner('<bdo class="cufon" dir=ltr></bdo>');
$('bdo.cufon').each(function() {
var word = $(this).text();
var splittext = word.split("");
var reversedtext = splittext.reverse();
var newtext = reversedtext.join("");
$(this).text(newtext);
});
}
});
CufonRTL = new CufonRTLClass;
レンダリングされたテキストは次のようになります。
<cufon class="cufon cufon-canvas" alt="כותרת " style="width: 80px; height: 28px; "><canvas width="110" height="28" style="width: 110px; height: 28px; top: 4px; left: -8px; "></canvas><cufontext>כותרת </cufontext></cufon>
その 'cufon' は問題ありませんが、RTL ではありません.. LTR です.. 構文に問題がありますか?
助けていただければ幸いです。
更新:クロムのコンソールで、これを見つけました:
これは私が関数を呼び出す方法です:
Cufon.replace('H1');
CufonRTL.RTL('H1');
更新: 私が知る限り、$ セレクターとの jQuery の競合があります。すべての $ sings をjQuery
There is no exception now, its just dont run で変換しました。
私はいくつかのデバッグを行い、彼がこのループに入っていないことを発見しました:
jQuery('bdo.cufon').each(function()
var CufonRTLClass=(function(){
this.RTL = RTL;
function RTL(tagName) {
jQuery(tagName)/*.css('font-size', '19px')*/.wrapInner('<bdo class="cufon" dir=ltr></bdo>');
jQuery('bdo.cufon').each(function() {
var word = jQuery(this).text();
var splittext = word.split("");
var reversedtext = splittext.reverse();
var newtext = reversedtext.join("");
jQuery(this).text(newtext);
});
}
});
CufonRTL = new CufonRTLClass;
ヘルプ?