Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Ogundele Olumide
@Lumexralph
thanks @mutantspore @h4r1m4u .....will work on it
CamperBot
@camperbot
lumexralph sends brownie points to @mutantspore and @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 1420 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
:star: 1142 | @mutantspore | http://www.freecodecamp.com/mutantspore
Joseph Morse
@jnmorse
@Lumexralph I had pause as another var that the interval function checks, if its paused it skips decrementing the current time, until it is unpaused. stop with clearIntrerval, also I wouldn't get any values from the dom, only interaction should be outputting to the dom.
Ogundele Olumide
@Lumexralph
@jnmorse ..you mean the click events?
Joseph Morse
@jnmorse
@Lumexralph in the first part of what I said, I meant when you click on paused I set a var paused to true, if you clear the interval and then start again its likely going to end up starting from the beginning, less you somehow save the state which I suppose could work.
h4r1m4u
@h4r1m4u
@jnmorse if you use only one variable to track the time and update it only when the timer reaches 0 (to start a new full work or break session), then your current time on the clock will be preserved when you clear the interval for pausing. clearing the interval seems cleaner rather than having the interval constantly running in the background even if the clock is paused
Joseph Morse
@jnmorse
@h4r1m4u the way I had it set up, the variable ended up back to its default state if I did clearinterval shrugs
Jovvi Johnson
@jovjohnson
@h4r1m4u http://codepen.io/jov/pen/mVoGXy
the spinners in my number fields aren't executing my jquery event
h4r1m4u
@h4r1m4u
@jovjohnson and what's the result that you want? what exactly should be happening?
Jovvi Johnson
@jovjohnson
and they're doing wonky things when the assorted veggies div field is clicked
the green text that displays the total price should be corresponding with the quantity and price per item
h4r1m4u
@h4r1m4u
ok, gotcha. let me have a look at it
Bruce Young
@mutantspore
@jovjohnson what is this? .. another new challenge?
Alvis Ng
@vizFlux
Hi guys, I’ve been coding the Pomodoro timer before this project recently categorized to an advanced front-end project. So it is being coded without any framework but plain JS, and now I am stucked at the timeCount() just won’t reach to 0 before ended and switched into breakInterval. Would really appreciate any help from anyone who’ve cleared this task. :smile:
var break_length;
var session_length;
var minutes;
var interval;
var breakInterval;
var seconds = 0;
​
function increaseBreak(break_length) {
    break_length++;
    $('#break').html(break_length);
    return break_length;
}
​
function decreaseBreak(break_length) {
    break_length--;
    if (break_length < 1) {
        break_length = 1;
    }
    $('#break').html(break_length);
    return break_length;
}
​
function increaseSession(session_length) {
    session_length++;
    $('#session').html(session_length);
    $('#total').html(session_length);
    return session_length;
}
​
function decreaseSession(session_length) {
    session_length--;
    if (session_length < 1) {
        session_length = 1;
    }
    $('#session').html(session_length);
    $('#total').html(session_length);
    return session_length;
}
​
function countdownCtrl() {
    if (seconds === 0) {
        minutes--;
        seconds = 59;
    } else {
        seconds--;
    }
    // Executing timeCount();
    (function timeCount() {
        if (minutes === 0 && seconds === 0) {
            clearInterval(interval);
            if (break_length) {
                breakInterval = setInterval(breakcountCtrl, 1000);
            }
        } else {
            $('#total').html(minutes + ":" + (seconds < 10 ? "0" : "") + String(seconds));
        }
    })();
​
    function breakcountCtrl() {
        $('#total').html(break_length--);
    }
}
​
$(document).ready(function() {
    break_length = parseInt($('#break').text());
    session_length = parseInt($('#session').text());
    minutes = session_length;
​
    $('#ibl').click(function() {
        break_length = increaseBreak(break_length);
    });
​
    $('#dbl').click(function() {
        break_length = decreaseBreak(break_length);
    });
​
    $('#ise').click(function() {
        session_length = increaseSession(session_length);
        minutes = session_length;
    });
​
    $('#dse').click(function() {
        session_length = decreaseSession(session_length);
        minutes = session_length;
    });
​
    $('#total').click(function() {
        if (interval) {
            clearInterval(interval);
            interval = undefined;
        } else {
            interval = setInterval(countdownCtrl, 50);
        }
    });
​
});
Harry Aydin
@HMAN1911
@jovjohnson You need to write a new function that deals with the counter value being changed, and make sure you're rendering the updated value on each click event. Hope that hint helps :smile:
edit: throw some console.log's in there to see if the value is actually being updated ;)
Ankit Panwar
@coderNoob
Guys lemme know if you can beat this game. Would be a great help :smile:
Tic-Tac-Toe
Jovvi Johnson
@jovjohnson
@hman1911 hmm. thanks. not sure where to start with a new function though. i'll play around with it some more.
CamperBot
@camperbot
jovjohnson sends brownie points to @hman1911 :sparkles: :thumbsup: :sparkles:
:star: 85 | @hman1911 | http://www.freecodecamp.com/hman1911
Ankit Panwar
@coderNoob
My reset button is not working. But works fine in DevTools mode. Why?
http://codepen.io/coderNoob/pen/vLmyWN
Harry Aydin
@HMAN1911
@jovjohnson This so question should help http://stackoverflow.com/questions/16562389/get-spinner-ui-value-on-change
$(document).ready(function() {

  function spinnerChange(event) {
    //this function gets called when the spinner value chages.
    //your code here :)
  }

  $('input[name=quantity]').on("click",function() {
               var button = $(this).closest(".quant");
               var price = button.data("price");
               price = parseFloat(price);
               var num = $("input[type=number]").val();
            var total = (num * price).toFixed(2);
            var totalPrint = $('<p class="total">($' + total + ' TOTAL)</p>');
                if(num >= 2){

                $('.price').find('.total').html(totalPrint);

                }

        });
h4r1m4u
@h4r1m4u
@jovjohnson here you go:
$(document).ready(function() {

  $('input[name=quantity]').on("click",function() {
               var price = $(this).data("price");
               price = parseFloat(price);
               var num = $(this).val();
                var total = (num * price).toFixed(2);
                if(num >= 2){
                  $(this).closest('.row').find('.total').text("($" + total + " TOTAL)");                            
                }            
        });

});
CamperBot
@camperbot
no wiki entry for: with the reset button anyone httpcodepeniocodernoobpenvlmywneditors1010
Ankit Panwar
@coderNoob
Help with the reset button anyone?
http://codepen.io/coderNoob/pen/vLmyWN?editors=1010
adhok
@adhok
Hi, I had a doubt regarding centering of the buttons for my front end project(Portfolio Page). I have used the container class made available by bootstrap css. Yet the buttons appear to be left-aligned. Here is the code.http://codepen.io/adhok/pen/PZVVPJ
Jovvi Johnson
@jovjohnson
@HMAN1911 thanks for the link
CamperBot
@camperbot
jovjohnson sends brownie points to @hman1911 :sparkles: :thumbsup: :sparkles:
:warning: jovjohnson already gave hman1911 points
Jovvi Johnson
@jovjohnson
@h4r1m4u works like a gem. would you mind briefly explaining my error?
h4r1m4u
@h4r1m4u
@adhok add text-center class on the row div that holds the buttons
    <div class="row text-center">
      <a href="www.twitter.com" target="_blank" class="btn btn-default btn-lg "><i class="fa fa-twitter fa-fw"></i>Twitter</a>
      <a href="www.twitter.com" target="_blank" class="btn btn-default btn-lg "><i class="fa fa-linkedin fa-fw"></i>LinkedIn</a>
      <a href="www.twitter.com" target="_blank" class="btn btn-default btn-lg"><i class="fa fa-github fa-fw"></i>GitHub</a>
      <a href="www.freecodecamp.com" target="_blank" class="btn btn-default btn-lg"><i class="fa fa-fire fa-fw"></i>FreeCodeCamp</a>      
    </div>
@jovjohnson i don't have your original code anymore :D do you still have it somewhere?
adhok
@adhok
@h4r1m4u Thank You!
CamperBot
@camperbot
adhok sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 1421 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Casey Heath
@ExhibitArts
This message was deleted
Jovvi Johnson
@jovjohnson
$(document).ready(function() {

           $('input[name^=quantity]').on("click",function() {
               var button = $(this).closest(".quant");
               var price = button.data("price");
               price = parseFloat(price);
               var num = $("input[type=number]").val();
            var total = (num * price).toFixed(2);
            var totalPrint = $('<p id="total">($' + total + ' TOTAL)</p>');
                if(num >= 2){

                $('.price').find('.total').html(totalPrint);

                }

        });
something like that anyway @h4r1m4u
haha
h4r1m4u
@h4r1m4u
$(document).ready(function() {

           $('input[name^=quantity]').on("click",function() {
               var button = $(this).closest(".quant"); //  not needed; you're already clicking on the input which contains the price in the data-price attribute, hence you can simply use "this"
               var price = button.data("price");
               price = parseFloat(price);
               var num = $("input[type=number]").val(); // similar to the above. it's the same input element, "this" suffices
            var total = (num * price).toFixed(2);
           // here you're using the jQuery selector $(), but the selector doesn't make much sense. selector should generally be a the element, class, id or combination of thereof
          // i'm assuming that what you meant to do here is to construct the string for the total price. if that's the case, you'd do it without the $() selector
            var totalPrint = $('<p id="total">($' + total + ' TOTAL)</p>'); 
                if(num >= 2){

                // the problem with the $('.price') selector is that it's the same in all the 3 boxes (each box has a .price paragraph). so even if you're changing
              // the qty in the 3rd box, it'll rewrite the total price in the first box. we need to somehow tie it to changing the price only in the box where we're
             // changing the qty - which is where "this" comes into play again
                $('.price').find('.total').html(totalPrint);

                }

        });
kaizen711
@kaizen711
Hey Guys, Does anybody know why the drop down in my navbar using bootstrap isn't working? Any help is appreciated.
http://codepen.io/kaizen7/pen/WrWGgp
h4r1m4u
@h4r1m4u
@kaizen711 you forgot to import the bootstrap.js file
add this in the JS resources of the codepen: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
@jovjohnson sorry, forgot to tag you. my comments as to why your code was not working are 3 messages above
kaizen711
@kaizen711
@h4r1m4u wow I didn't even know that existed, thank you very much, I'd been trying to see what was wrong for a while
CamperBot
@camperbot
kaizen711 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 1422 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
@kaizen711 np. yeah, basically all the functionality that's described on this page: http://getbootstrap.com/javascript/ requires the bootstrap.js library imported
kaizen711
@kaizen711
@h4r1m4u awesome thanks again