jquery - If statemant doesnt work with timeout function inside -


i trying delay actions inside function. work when try include them inside timeout function if statement if( percent > 50) doesn't work. elements, not once percent higher 50. tried .delay(3000), doesn't work.

if (percent > 50) {   $(this).addclass("gt-50").delay(3000);   $(".gt-50").children('.ppc-progress').css('clip','rect(0px, '+ widthhalf +'px, '+ width +'px, 0px) ').delay(3000);   $(".gt-50").children('.ppc-progress').children('.ppc-progress-fill').css('clip','rect(0px, '+ width +'px, '+ width +'px, '+ widthhalf +'px) ').delay(3000); } 

so conclusion, either if statement works either timeout function, cant accomplish both of them work. have idea?

jquery(function ($) {   $( ".progress-pie-chart" ).each(function(  ) {      percent = parseint($(this).data('percent'));      var width = $(this).width();     var widthhalf = width / 2;      if (percent > 50) {       settimeout(function () {         $(".progress-pie-chart").addclass("gt-50");         $(".gt-50").children('.ppc-progress').css('clip','rect(0px, '+ widthhalf +'px, '+ width +'px, 0px) ');         $(".gt-50").children('.ppc-progress').children('.ppc-progress-fill').css('clip','rect(0px, '+ width +'px, '+ width +'px, '+ widthhalf +'px) ');       }, 3000);     }     $( ).css('height',''+ width +'px');     $( ).children('.ppc-progress').children('.ppc-progress-fill').css('transform','rotate('+ deg +'deg)');     $( ).children('.ball-holder').css('transform','rotate('+ deg +'deg)');     $( ).children('.ppc-progress').css('clip','rect(0px, '+ width +'px, '+ width +'px, '+ widthhalf +'px) ');     $( ).children('.ppc-progress').children('.ppc-progress-fill').css('clip','rect(0px, '+ widthhalf +'px, '+ width +'px, 0px) ');     $('.summ-cont').css('top',''+ -widthhalf +'px');   }); }); 


Comments