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
Rami
@RNwebdk
put the functions inside of the play function
awesome
that makes sense
sparklie3
@sparklie3
there's other ways
such as passing the values of i into the function
you could do something like check (answer, i)
and then you define function check (answer, i) {blah blah}
it depends on how you want to do it and if you are truly making the functions reusuable
Rami
@RNwebdk
yes, but that is the hard way :)
sparklie3
@sparklie3
don't think of it as hard
just different
you'll eventually be doing that stuff
because let's say another function needs to call check (answer)
you don't want to rewrite the code over and over again
and then, maintaining is hard
Rami
@RNwebdk
i see
thank you @sparklie3
CamperBot
@camperbot
rnwebdk sends brownie points to @sparklie3 :sparkles: :thumbsup: :sparkles:
:warning: rnwebdk already gave sparklie3 points
sparklie3
@sparklie3
np
Manish Giri
@Manish-Giri
anyone knows how to draw text with animation on screen?
miriam-z
@miriam-z
@teachtyler I have tried the code in your code pen and my dividers are rendering as short dividers and not full length as they are in the code?
@TylerMoeller I have tried the code in your code pen and my dividers are rendering as short dividers and not full length as they are in the code?
Mark
@vinarius
hey guys, how would i appropriately target an id element using jquery?
$("'#" + streamers[i] + "'").removeClass("active");
Michael Karpinski
@karpimpski
@vinarius that's the correct way to target an id element
if streamers[i] is a string, the last set of quotes SHOULDN'T be necessary, but may be with jQuery
FonkyShizuma
@FonkyShizuma
Malala Yousafzai Tribute Page: https://codepen.io/Shizuma/details/gLQwdO
sparklie3
@sparklie3
general question
i'm writing a ajax call inside a function
but ajax calls are suppose async
so when i make the call to the function in another function, i have to wait for the response
before I can do anything
for example, my code
```
function ajax(){
$.ajax ({
//does a ajax call

});
}

function  second(){
  ajax();
  //does something more, but want to wait for ajax call

}
i don't think i'm doing this right because now, my second function has to wait for the ajax call to complete before I can do anything
how should i approach this problem?
Michael Karpinski
@karpimpski
@sparklie3 use Ajax's built in method success
it will run whatever code is in the success function after you get the response from the server
$.ajax ({
//does a ajax call
    url: 'www.example/com',
    success: function(data){
        //will execute code in here after data is received
    }
});
Tyler Moeller
@TylerMoeller
@miriam-z Not sure how to help without seeing your code :/
@karpimpski @sparklie3 The new way of doing it though is with jQuery's newer deferred callbacks rather than using success. http://stackoverflow.com/a/14754681/5253639
var jqxhr = $.ajax( "example.php" )
  .done(function() {
    alert( "success" );
  })
  .fail(function() {
    alert( "error" );
  })
  .always(function() {
    alert( "complete" );
  });

// Perform other work here ...

// Set another completion function for the request above
jqxhr.always(function() {
  alert( "second complete" );
});
Michael Karpinski
@karpimpski
@TylerMoeller yep, should've mentioned that. sorry, I tend to shy away from jQuery and prefer vanilla JS. thanks for the correction!
CamperBot
@camperbot
karpimpski sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1156 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
The success callback still works great for that purpose - still a good suggestion!
William Cross
@williamtech814

I'm attempting to make a collapsible navbar for the portfolio project. Not sure what I'm doing wrong, my navbar won't collapse: <!-- nav bar -->

<nav style="background-color:#ffaa00" class="navbar navbar-light navbar-static-top">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">Portfolio Site</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navigation"><span class="glyphicon glyphicon-menu-hamburger"></span></button>
</div>

<div class="collapse navbar-collapse navigation">
<ul class="nav navbar-nav navbar-right" >
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>

miriam-z
@miriam-z
@TylerMoeller this is a code pen http://codepen.io/miriam-z/pen/WoYojX
Tyler Moeller
@TylerMoeller
@williamtech814 Your navbar collapses fine for me - do you have bootstrap added to your project along with jQuery and bootstrap.min.js?
blob
@miriam-z I don't see where you have added a left-border to your navbar link items in that codepen