题
我有一个问题。我想,当按下按钮(因为它显示在一个特定的DIV被用户看到)来更新计数器。所以发生这种情况时按下按钮:
$("#photo-counter span").empty().append((start_index+1)+"-"+(end_index+1)+" / "+files.length);
sIFR.replace(netto, { selector: "#photo-counter span"});
由于在第一时间自动运行这个,一切工作正常,但是当我点击该按钮div
不受sIFR
取代。
任何人可以帮助?
解决方案
您可以真正做到这一点:
sIFR.replacements["#photo-counter span"][0].replaceText((start_index+1)+"-"+(end_index+1)+" / "+files.length);
没有必要更新HTML,sIFR的照顾所有这一切为你。
其他提示
更多代码可能是用于解决该有用。
总之,这里是一个镜头:
更改您点击直播点击:
$('#yourElement').live('click', function(){
$("#photo-counter span").empty().append((start_index+1)+"-"+(end_index+1)+" / "+files.length);
sIFR.replace(netto,{
selector: "#photo-counter span"
});
});
希望这有助于!
这里是全码:
$("#arrow-left").mouseup(function() {
if(!$("#frame > *").is(":animated") && status != "fullscreen"){
$(this).css({"opacity":"1.0"});
arrowClick("left");
}};
function arrowClick(direction) {
(...) /* i dont think the problem is located somewhere here */
refreshCounter(start, end);
(...)
}
function refreshCounter(start_index, end_index) {
if(files.length > 0) {
start_i = start_index;
end_i = end_index;
if(start_index !=null && end_index != null) {
$("#photo-counter span").empty().append((start_index+1)+"-"+(end_index+1)+" / "+files.length);
sIFR.replace(netto, { selector: "#photo-counter span"});
}
}
不隶属于 StackOverflow