Blog for web designers

Refresh function with setimeout in jquery

With jquery you can refresh function with setimeout.

In my previous project I had face a problem with a flex slider relating height. The issue was with the slider having thumbnail and sliding image both. Not every sliding images height were same so there was a space between sliding image and thumbnail in some cases. Now my clients ask me to have a extensible height of that slider. Means the height should update every time and it should fit without having a gap.

First I tried to refresh function with setimeout in jquery for thumbnails. Then I called the function to start on browser load.


function refresh_height_in_three_sec(){
		var getHeight = $(".flex-active-slide img").height();
		$(".flex-active-slide").parents(".flex-viewport").height(getHeight);
		setTimeout(refresh_height_in_one_sec, 3000);
}
        sld_height();

	$("body").on('click', '.flex-control-thumbs', function(event) {
			sld_height();	
			
	});


Santosh Shah

My name is Santosh Shah and blogs at santosh-shah.com


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.