<script> $(document).ready(function() { function synchronizeClasses() { var index = $('.h-product-sort li.on').index(); $('.h-product-list li').removeClass('on'); $('.h-product-list li').eq(index).addClass('on'); } setInterval(synchronizeClasses, 500); }); </script>