Morgan Ng
Morgan Ng

Reputation: 813

Countdown time for specified condition on div on span

Im using similar countdown on particular by counting 3.49minutes . However the problem is the countdown span are totally different with the similar countdown that i did as i need to implement the same function for this particular time and match each other time. Sorry if my explanation not clear enough.

HTML:

<div class="clock cl-count"> 
                      <b class="clock_b0">00</b> 
                      <b class="clock_b1">03</b> 
                      <b class="clock_b2">49</b> 
                      <span class="s"></span>
                  </div> 

Above of this are working by getting time from that javascript i did.

<dd class="sortableitem on" data-lt-cls="ssc" data-default="3" data-lt="CQSSC">
                  <div><em>重庆时时彩</em><span countdown="1">03:49</span>
                  </div>
               </dd> 

The question is how to we implement the same function to get the countdown for above this ? without changing the div

my working Jquery for the first section Code :

var secondSum = 230;
            var time = setInterval(function(){
                secondSum--;
                if(secondSum == 0){
                    secondSum = 230;
                }
                var minute = parseInt(secondSum/60);
                var second = secondSum - minute*60;
                $('.clock_b1').html("0" + minute);
                $('.clock_b2').html(second>9?second:"0"+second);
            }, 1000)  

Upvotes: 1

Views: 480

Answers (1)

RAJNIK PATEL
RAJNIK PATEL

Reputation: 1049

Try this :

var secondSum = 230;
            var time = setInterval(function(){
                secondSum--;
                if(secondSum == 0){
                    secondSum = 230;
                }
                var minute = parseInt(secondSum/60);
                var second = secondSum - minute*60;
                
                
                $("#countdown1").text("0"+minute+":"+ (second>9?second:"0"+second));
                
            }, 1000)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 
                  
                  <dd class="sortableitem on" data-lt-cls="ssc" data-default="3" data-lt="CQSSC">
                  <div><em>重庆时时彩 </em><span id="countdown1" countdown="1">03:49</span>
                  </div>
               </dd>

Upvotes: 2

Related Questions