☰
$('.number').on('click', function() { var selectedNumber = $(this).data('value'); // do rest of code }
1. press 5, num is now "5"
2. press divide (num is now "5") (operate is now [5]
3. press 3 (num is now 53") (operate is now [5,/, 53]
cameron-burkholder sends brownie points to @teamamerica9 :sparkles: :thumbsup: :sparkles:
:cookie: 10 | @teamamerica9 |http://www.freecodecamp.com/teamamerica9
figure
and get rid of this guy:*{
margin: 0px;
padding: 0px;
}
cameron-burkholder sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @r1chard5mith |http://www.freecodecamp.com/r1chard5mith
cameron-burkholder sends brownie points to @r1chard5mith :sparkles: :thumbsup: :sparkles:
:warning: cameron-burkholder already gave r1chard5mith points
button
inside the a
, not vice versa
......
, also show the operator pressed
ashrisoft sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1413 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
body {
background-color: red;
}
function cpuSeq() {
seq = [Math.floor(Math.random() * choices.length)];
cpuSeq.push(seq);
$("#"+seq).trigger("click");
console.log(seq + " cpu choice");
}
document.ready(function(){
alert("start");
cpuSeq();
});
Trying to start my SIMON game with cpu picking random button.. I cant get cpuSeq to run though... I have a callback in doc.ready but the alert and the cpuSeq Function isnt working
123xylem sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 715 | @sorinr |http://www.freecodecamp.com/sorinr
fl0ryc3l sends brownie points to @sf-jd :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @sf-jd |http://www.freecodecamp.com/sf-jd
function cpuSeq() {
setTimeout(function() { var ind = [Math.floor(Math.random() * choices.length)];
seq=choices[ind]; //seq is the value of random choice element
$("#"+seq).trigger("click");
console.log(cSeq + " cpu array" +pSeq);
}, 1000);
cSeq.push(seq);
while(cSeq.length<10){
cpuSeq();
}
//HOW DO I STOP CPU CLICK ADDING TO PLAYERCLICK ARRAY????? pSeq.shift();
}
My simon game is progressing slowly.. Question is... How do i get my cpu to keep clicking itself without infi looping?
I have set this timout function that clicks and adds to an array on each click. It stops when the array is a certain length.. but this function just fills the array quickly and only clicks once... Any ideas?
Hey everyone. I'm trying to access the user's nearest city for the local weather app. Here's the code I have so far:
//get client's ip address
$.getJSON('//freegeoip.net/json/?callback=?', function(data){
var items = (JSON.stringify(data, null, 2));
console.log(items);
var city = items["city"];
console.log(city);
});
The first console.log returns a nice object:
{
"ip": "210.13.83.19",
"country_code": "CN",
"country_name": "China",
"region_code": "31",
"region_name": "Shanghai",
"city": "Shanghai",
"zip_code": "",
"time_zone": "Asia/Shanghai",
"latitude": 31.0456,
"longitude": 121.3997,
"metro_code": 0
}
However, the second console.log returns 'undefined'. I'm not sure why.
$.getJSON('//freegeoip.net/json/?callback=?', function(data){
var city = data.city
console.log(city);
});
robertridley1988 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 551 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
tourdejord sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 552 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
dracul3a sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 553 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
http://codepen.io/123xylem/pen/jrAKPN?editors=1011
So I have a potential fudamental error... Need to be able to click a panel and only have it push the answer for USER...
At the moment when the CPU clicks a panel it pushes that answer aswell... So i need to either declare its a user clicking or code something into the cpuFunction
$(".panel").on("click",function(){
var panelId=$(this).attr("id");
audioF[panelId.toLowerCase()].play(); //<-----use id as key
$("#"+panelId).toggleClass("animate");
pSeq.push(panelId); //HERE I PUSH CLICKED PANEL INTO ARRAY But CPU click also triggers this :(
// console.log(panelId,"player");
});
function cpuSeq() {
count++;
newChoice(); //seq is the value of random choice element
interval =
setInterval(function() {
$("#"+seq).trigger("click");
cSeq.push(seq);
console.log(cSeq + cSeq.length);
newChoice();
if(cSeq.length>=count){clearInterval(interval);
cSeq=[];}
}, 1000);
}
function newChoice(){
ind= [Math.floor(Math.random() * choices.length)];
seq=choices[ind];
return seq;
}
$("#start").on("click",function(){cpuSeq();
})
$(".panel").on("click",function(){
var panelId=$(this).attr("id");
audioF[panelId.toLowerCase()].play(); //<-----use id as key
$("#"+panelId).toggleClass("animate");
pSeq.push(panelId);
// console.log(panelId,"player");
});
function cpuSeq() {
count++;
newChoice(); //seq is the value of random choice element
interval =
setInterval(function() {
if(cSeq.length>=1){ for(i=0;i<cSeq.length;i++){
// HERE IS MY ATTEMPT IF cpuSeq has notes in it... play them again before making new ones.
audioF[cSeq[i].toLowerCase].play(); } }
audioF[seq.toLowerCase()].play();
cSeq.push(seq);
console.log(cSeq + cSeq.length, pSeq);
newChoice();
if(cSeq.length>=count){clearInterval(interval);
cSeq=[];}
}, 1000);
}
How can I get the cpuSeq to play the notes it played before...
kirahmadlare sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 716 | @sorinr |http://www.freecodecamp.com/sorinr
baby007mix sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 717 | @sorinr |http://www.freecodecamp.com/sorinr
'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + lat + '%2C' + lon + '&language=en'
baby007mix sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: baby007mix already gave sorinr points
poking around :nth-child selector. What am i doing wrong here..
isn't
p:nth-child(1)
suppose to select my first lorem ipsum paragraph?
body
as parent. But now it has none, having your nav
in front? Enclose it in a div maybe and use it as a parent? Just an idea.
:cookie: 328 | @kat-mag |http://www.freecodecamp.com/kat-mag
steveamaki sends brownie points to @kat-mag :sparkles: :thumbsup: :sparkles:
<div class="container">
<div class="jumbotron">
content here
</div>
</div>
leo9319 sends brownie points to @steveamaki :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @steveamaki |http://www.freecodecamp.com/steveamaki
leo9319 sends brownie points to @steveamaki :sparkles: :thumbsup: :sparkles:
:warning: leo9319 already gave steveamaki points
#first img {
width: 100%;
}
$.ajax()
method instead of simply .getJSON()
to try and use the error:
attribute but still had no luck. https://codepen.io/jrandall/pen/pEjqQN?editors=1112
jrandallhansen sends brownie points to @amitp88 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for amitp88
console.log
statement for each case
.getJSON
but commented out) and both have the issue
...channels/blablabla,kekek,ololo...
returns only on
users, i think u need compare arrays on
users and global array for see difference and dead accounts.
dead
nikhil-m sends brownie points to @steveamaki :sparkles: :thumbsup: :sparkles:
:cookie: 123 | @steveamaki |http://www.freecodecamp.com/steveamaki
jrandallhansen sends brownie points to @amitp88 and @ndrsrv :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @ndrsrv |http://www.freecodecamp.com/ndrsrv
:warning: could not find receiver for amitp88
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target1").prop("disabled", true);
$("#target4").remove();
$("#target2").appendTo("#right-well");
$("#target5").clone().appendTo("#left-well");
$("#target1").parent().css("backgorund-color","red");
}
$('#tweet-quote').attr('href', 'https://twitter.com/intent/tweet?text='+content).attr('target', '_blank');
@zarruk
this might helpful
https://dev.twitter.com/web/tweet-button/parameters
if you add
data-text="custom share text"
inside your
<a href="https://twitter.com/share" class="twitter-share-button" data-text="custom share text">
section you will see something like
body {height: 100%}
but then I loose the <footer> at the bottom of the page. I have tried section {height: 100%}
but it doesn't work. Any ideas? Here's the pen if you want to have a look: https://codepen.io/RickLee/pen/BLzpAR
:cookie: 267 | @joacosz |http://www.freecodecamp.com/joacosz
emamador sends brownie points to @joacosz :sparkles: :thumbsup: :sparkles:
rangerrick337 sends brownie points to @wrivera51 :sparkles: :thumbsup: :sparkles:
:cookie: 149 | @wrivera51 |http://www.freecodecamp.com/wrivera51
h7, h8 and h9
didn't exist
.h7 { } .h8 {}
.etc
<h9>
is never closed, <img>
can't contain something if you wan't html opinion @JoacoSz
<img src="" alt="" />
that's how image element must be />
means that it's autoclosed like input elements or br or hr
joacosz sends brownie points to @alexanderdom :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @alexanderdom |http://www.freecodecamp.com/alexanderdom
<style>
/* PARALLAX */
body, html {
height: 100%;
}
.parallax {
/* The image used */
background-image: url('http://res.cloudinary.com/dvnpariof/image/upload/v1474308988/html_css_javascript_jquery_x8hgdd.jpg');
padding-top: 20px;
filter:brightness(30%);
/* Full height */
height: 100%;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.jumbotron {
height: 100%;
padding:100px 0px;
margin: 0px 125px 0px 125px;
color: white;
background: transparent;
}
</style>
<!--parallax-->
<div class="parallax">
<!-- About me-->
<div class="container-fluid jumbotron" id="section1">
<h1>Web Development</h1>
<div class="col-xs-9"><br>
<p>I am a web developer currently living in Cypress, CA. I enjoy building diverse websites from small businesses to
interactive web applications. If you would like more information or would like to hire, you can contact me<a href="http://localhost/portfolio/portfolio.php#section3"> here</a>.</p>
<p>Design (HTML, CSS, jQuery)</p>
<p>Development & Database Setup (PHP, MySQL, SQL)</p>
</div>
<div class="col-xs-3">
<img class="img-responsive" src="https://res.cloudinary.com/dvnpariof/image/upload/v1470496297/12936657_1089804404416345_5148942723251757505_n_zrkauk.jpg"
alt="me" style="width:220px;height:220px" id="me">
</div>
</div>
</div>
Hello, I have a dark background and I need the text to remain white. But the text also gets darkened with the background as well. Any solutions?
color: white;
to your .parallax class
color: white;
in your .parallax class styling?
filter: brightness(30%)
is applied to the whole parallax element which is affecting your text as well. Maybe it would work to put that somewhere else? I'll have a try
gnosyaj sends brownie points to @rangerrick337 :sparkles: :thumbsup: :sparkles:
:cookie: 105 | @rangerrick337 |http://www.freecodecamp.com/rangerrick337
amitp88 sends brownie points to @steveamaki :sparkles: :thumbsup: :sparkles:
:cookie: 125 | @steveamaki |http://www.freecodecamp.com/steveamaki
@N1CKL3 Here's my remedy..
function truncateString(str, num) {
if(num <= 3) {
return str.slice(0,num) + "...";
} else {
// ??
}
}
truncateString("A-tisket a-tasket A green and yellow basket", 2);
n1ckl3 sends brownie points to @steveamaki and @konikodes and @emamador :sparkles: :thumbsup: :sparkles:
:cookie: 126 | @steveamaki |http://www.freecodecamp.com/steveamaki
:warning: could not find receiver for emamador
:cookie: 372 | @konikodes |http://www.freecodecamp.com/konikodes
HELP!
I want to have a scrolling effect when Video and Timeline buttons are clicked. Right now its just jumping into the section.
@SteveAmaki I think this article may help you...
http://stackoverflow.com/questions/4801655/how-to-go-to-a-specific-element-on-page/11986153#11986153
You'll need to use either native JS or JQuery...
PS: Good evening all! :)
steveamaki sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
n1ckl3 sends brownie points to @emamador and @steveamaki :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for emamador
:warning: n1ckl3 already gave steveamaki points
n1ckl3 sends brownie points to @wearenotgroot and @steveamaki and @gbsimon87 :sparkles: :thumbsup: :sparkles:
:warning: n1ckl3 already gave steveamaki points
:cookie: 329 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
:star2: 1757 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
@mpettaw2 the problem is
if(mMove===step){
mMove is your function, if you wanted value from it you should probably execute it.
so
mMove()
amitp88 sends brownie points to @steveamaki :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave steveamaki points
Secondly, you're giving the same styles to differeny blocks, why not just create one style with those values in it and apply that one style to the different divs?
I'll send you a file back to demonstrate what I mean...
flashards sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:cookie: 330 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
flashards sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:warning: flashards already gave gbsimon87 points
<div class="row">
<div class="col-xs-4">
</div>
<div class="col-xs-7"
</div>
<div class="col-xs-6">
</div>
</div>
n1ckl3 sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
:warning: n1ckl3 already gave gbsimon87 points
+ .copine
:]