Я использую SIFR заменить мой навигационный текст с новым шрифтом:Вызов javascript из sifr заменил теги привязки?
<ul>
<li><a href="#">about</a></li>
<li><a href="#">reel</a></li>
<li><a href="#">contact</a></li>
<li><a href="#">archive</a></li>
<li><a href="#">login</a></li>
</ul>
sIFR.replace(futura, {
css: [
'.sIFR-root { background-color:transparent; color: #999999; cursor:pointer; font-size:26px; text-transform:uppercase; }',
'a { color: #999999; text-decoration:none; }',
'a:hover { color: #CCCCCC; text-decoration:none; }'
],
fitExactly:true,
forceClear:true,
forceSingleLine:true,
selector: '#navigation ul li',
transparent:true
});
Это работает просто отлично. Я тогда пытаюсь добавить некоторые действия для навигации с помощью JQuery: кажется, работает, хотя, потому что метки анкерные скрыты SIFR, когда содержимое заменяется
$(document).ready(function(){
$("#navigation ul li a").click(function(event){
event.preventDefault();
alert("nav clicked");
});
});
Эти действия не. Как добавить код jQuery для замеченных тегов? Я скорее бы не сделать что-то вроде следующего (и пусть Javascript вызывается из Flash), поскольку это своего рода поражения вся цель ненавязчивого JavaScript:
<a href="javascript:gotoSection('about');">about</a>
Edit (генерируется HTML):
<ul>
<li style="" class="sIFR-replaced"><object width="88" height="37" class="sIFR-flash" type="application/x-shockwave-flash" id="sIFR_replacement_0" name="sIFR_replacement_0" data="/swf/bfuturah.swf" style=""><param name="flashvars" value="id=sIFR_replacement_0&content=%253Ca%2520href%253D%2522/home/about%2522%2520target%253D%2522%2522%253EABOUT%253C/a%253E&width=55&renderheight=37&link=/home/about&target=&size=26&css=.sIFR-root%257Bcolor%253A%2523999999%253B%257Da%257Bcolor%253A%2523999999%253Btext-decoration%253Anone%253B%257Da%253Ahover%257Bcolor%253A%2523CCCCCC%253Btext-decoration%253Anone%253B%257D&cursor=pointer&tunewidth=0&tuneheight=0&offsetleft=&offsettop=&fitexactly=true&preventwrap=false&forcesingleline=true&antialiastype=&thickness=&sharpness=&kerning=&gridfittype=pixel&flashfilters=&opacity=100&blendmode=&selectable=true&fixhover=true&events=false&delayrun=false&version=436"/><param name="wmode" value="transparent"/><param name="bgcolor" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/></object><span class="sIFR-alternate" id="sIFR_replacement_0_alternate"><a href="/home/about">about</a></span></li>
<li style="" class="sIFR-replaced"><object width="58" height="37" class="sIFR-flash" type="application/x-shockwave-flash" id="sIFR_replacement_1" name="sIFR_replacement_1" data="/swf/bfuturah.swf" style=""><param name="flashvars" value="id=sIFR_replacement_1&content=%253Ca%2520href%253D%2522/home/reel%2522%2520target%253D%2522%2522%253EREEL%253C/a%253E&width=42&renderheight=37&link=/home/reel&target=&size=26&css=.sIFR-root%257Bcolor%253A%2523999999%253B%257Da%257Bcolor%253A%2523999999%253Btext-decoration%253Anone%253B%257Da%253Ahover%257Bcolor%253A%2523CCCCCC%253Btext-decoration%253Anone%253B%257D&cursor=pointer&tunewidth=0&tuneheight=0&offsetleft=&offsettop=&fitexactly=true&preventwrap=false&forcesingleline=true&antialiastype=&thickness=&sharpness=&kerning=&gridfittype=pixel&flashfilters=&opacity=100&blendmode=&selectable=true&fixhover=true&events=false&delayrun=false&version=436"/><param name="wmode" value="transparent"/><param name="bgcolor" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/></object><span class="sIFR-alternate" id="sIFR_replacement_1_alternate"><a href="/home/reel">reel</a></span></li>
<li style="" class="sIFR-replaced"><object width="116" height="37" class="sIFR-flash" type="application/x-shockwave-flash" id="sIFR_replacement_2" name="sIFR_replacement_2" data="/swf/bfuturah.swf" style=""><param name="flashvars" value="id=sIFR_replacement_2&content=%253Ca%2520href%253D%2522/home/contact%2522%2520target%253D%2522%2522%253ECONTACT%253C/a%253E&width=76&renderheight=37&link=/home/contact&target=&size=26&css=.sIFR-root%257Bcolor%253A%2523999999%253B%257Da%257Bcolor%253A%2523999999%253Btext-decoration%253Anone%253B%257Da%253Ahover%257Bcolor%253A%2523CCCCCC%253Btext-decoration%253Anone%253B%257D&cursor=pointer&tunewidth=0&tuneheight=0&offsetleft=&offsettop=&fitexactly=true&preventwrap=false&forcesingleline=true&antialiastype=&thickness=&sharpness=&kerning=&gridfittype=pixel&flashfilters=&opacity=100&blendmode=&selectable=true&fixhover=true&events=false&delayrun=false&version=436"/><param name="wmode" value="transparent"/><param name="bgcolor" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/></object><span class="sIFR-alternate" id="sIFR_replacement_2_alternate"><a href="/home/contact">contact</a></span></li>
<li style="" class="sIFR-replaced"><object width="110" height="37" class="sIFR-flash" type="application/x-shockwave-flash" id="sIFR_replacement_3" name="sIFR_replacement_3" data="/swf/bfuturah.swf" style=""><param name="flashvars" value="id=sIFR_replacement_3&content=%253Ca%2520href%253D%2522/archive%2522%2520target%253D%2522%2522%253EARCHIVE%253C/a%253E&width=72&renderheight=37&link=/archive&target=&size=26&css=.sIFR-root%257Bcolor%253A%2523999999%253B%257Da%257Bcolor%253A%2523999999%253Btext-decoration%253Anone%253B%257Da%253Ahover%257Bcolor%253A%2523CCCCCC%253Btext-decoration%253Anone%253B%257D&cursor=pointer&tunewidth=0&tuneheight=0&offsetleft=&offsettop=&fitexactly=true&preventwrap=false&forcesingleline=true&antialiastype=&thickness=&sharpness=&kerning=&gridfittype=pixel&flashfilters=&opacity=100&blendmode=&selectable=true&fixhover=true&events=false&delayrun=false&version=436"/><param name="wmode" value="transparent"/><param name="bgcolor" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/></object><span class="sIFR-alternate" id="sIFR_replacement_3_alternate"><a href="/archive">archive</a></span></li>
<a href="/archive"> </a><li style="" class="sIFR-replaced"><object width="80" height="37" class="sIFR-flash" type="application/x-shockwave-flash" id="sIFR_replacement_4" name="sIFR_replacement_4" data="/swf/bfuturah.swf" style=""><param name="flashvars" value="id=sIFR_replacement_4&content=%253Ca%2520href%253D%2522/login%2522%2520target%253D%2522%2522%253ELOGIN%253C/a%253E&width=50&renderheight=37&link=/login&target=&size=26&css=.sIFR-root%257Bcolor%253A%2523999999%253B%257Da%257Bcolor%253A%2523999999%253Btext-decoration%253Anone%253B%257Da%253Ahover%257Bcolor%253A%2523CCCCCC%253Btext-decoration%253Anone%253B%257D&cursor=pointer&tunewidth=0&tuneheight=0&offsetleft=&offsettop=&fitexactly=true&preventwrap=false&forcesingleline=true&antialiastype=&thickness=&sharpness=&kerning=&gridfittype=pixel&flashfilters=&opacity=100&blendmode=&selectable=true&fixhover=true&events=false&delayrun=false&version=436"/><param name="wmode" value="transparent"/><param name="bgcolor" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/></object><span class="sIFR-alternate" id="sIFR_replacement_4_alternate"><a href="/login">login</a></span></li>
</ul>
Ниццы! Это очень помогает. Есть ли способ отменить действие по умолчанию тега привязки (event.preventDefault или вернуть false) в этом контексте? – typeoneerror
Честно говоря, я не совсем уверен, я раньше не использовал sIFR со ссылками. Есть несколько удобных обратных вызовов в http://wiki.novemberborn.net/sifr3/JavaScript%2BMethods - modifyContentString или modifyContent, вероятно, можно использовать для замены ссылок с помощью пробелов, прежде чем sIFR их использует, таким образом они не будут в конечном итоге как элементы навигации в фильме. Это стоит сделать :-) –