$(function() {
if(portfolio_slide_TOTAL.currSlideId == 4) {
// your code here!
$('#portfolio_carousel_thumbs').data('touchCarousel').goTo(4);
$("#color_goto").addClass("library_thumb_active");
}
});
$(function() {
portfolio_slide_TOTAL.ev.on('rsAfterSlideChange', function() {
if(portfolio_slide_TOTAL.currSlideId == 4) {
// your code here!
$('#portfolio_carousel_thumbs').data('touchCarousel').goTo(4);
}
});
});
答案 0 :(得分:2)
尝试:
$(function() {
var flag=true;
test_slide(); //runs first
portfolio_slide_TOTAL.ev.on('rsAfterSlideChange', test_slide);
function test_slide() {
if(portfolio_slide_TOTAL.currSlideId == 4) {
// your code here!
$('#portfolio_carousel_thumbs').data('touchCarousel').goTo(4);
if (flag) {
$("#color_goto").addClass("library_thumb_active"); //only on first
flag=false; //set flag to false after first run
}
}
}
});