temp
, or wrap it into a function and send temp
as an argument to that function. Make sure it's a number not text too - should work fine after that
var far;
which sets it to undefined and then asking if far > 80
or undefined > 80
.css('background-image','url(http://res.cloudinary.com/dh8lrmygd/image/upload/v1496705892/pexels-photo-29724_gwrog9.jpg)'
http://res.cloudinary.com/dh8lrmygd/image/upload/v1496705892/pexels-photo-29724_gwrog9.jpg
have to be quoted ? ;)
.css('background-image','url("http://res.cloudinary.com/dh8lrmygd/image/upload/v1496705892/pexels-photo-29724_gwrog9.jpg")'
ericvoigt sends brownie points to @lordmathis :sparkles: :thumbsup: :sparkles:
:cookie: 342 | @lordmathis |http://www.freecodecamp.com/lordmathis
temp
background-attachment: fixed
Hello All,
I could use some feedback on my FCC: wikipedia project
https://codepen.io/sconde/full/LLYJYr/
r0ulito sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1624 | @skyc0der |http://www.freecodecamp.com/skyc0der
.the-class-you-want-to-change {
prop1:value!important;
prop2:value!important;
fullmetal7777 sends brownie points to @r0ulito :sparkles: :thumbsup: :sparkles:
:cookie: 272 | @r0ulito |http://www.freecodecamp.com/r0ulito
r0ulito sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: r0ulito already gave skyc0der points
!important
.
skyc0der sends brownie points to @r0ulito :sparkles: :thumbsup: :sparkles:
:cookie: 273 | @r0ulito |http://www.freecodecamp.com/r0ulito
!important
is for the weak :) always a way around it
body{background: url("https://cdn.pixabay.com/photo/2014/09/11/18/23/london-441853_960_720.jpg");}
djfrakes sends brownie points to @sergrdz7 and @longnt80 and @fdemaa and @r0ulito :sparkles: :thumbsup: :sparkles:
:cookie: 137 | @fdemaa |http://www.freecodecamp.com/fdemaa
:cookie: 328 | @longnt80 |http://www.freecodecamp.com/longnt80
:cookie: 274 | @r0ulito |http://www.freecodecamp.com/r0ulito
:cookie: 281 | @sergrdz7 |http://www.freecodecamp.com/sergrdz7
fdemaa sends brownie points to @sconde :sparkles: :thumbsup: :sparkles:
:cookie: 295 | @sconde |http://www.freecodecamp.com/sconde
fdemaa sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 329 | @longnt80 |http://www.freecodecamp.com/longnt80
fdemaa sends brownie points to @bytao7mao :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @bytao7mao |http://www.freecodecamp.com/bytao7mao
djfrakes sends brownie points to @bytao7mao :sparkles: :thumbsup: :sparkles:
:cookie: 123 | @bytao7mao |http://www.freecodecamp.com/bytao7mao
https://cdn.pixabay.com/photo/2017/04/10/10/08/universe-2218012_960_720.jpg
1code1 sends brownie points to @bytao7mao :sparkles: :thumbsup: :sparkles:
:cookie: 124 | @bytao7mao |http://www.freecodecamp.com/bytao7mao
jazzliberation sends brownie points to @1code1 and @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: @1code1's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
:star2: 1625 | @skyc0der |http://www.freecodecamp.com/skyc0der
height: 100%
only works when the element outside has a specific height already set.
azmah21 sends brownie points to @1code1 :sparkles: :thumbsup: :sparkles:
:warning: @1code1's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
1code1 sends brownie points to @bytao7mao :sparkles: :thumbsup: :sparkles:
:warning: 1code1 already gave bytao7mao points
1code1 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1626 | @skyc0der |http://www.freecodecamp.com/skyc0der
<li><a href="#About">About</a></li>
<div id="About"></div>
:cookie: 138 | @fdemaa |http://www.freecodecamp.com/fdemaa
ccs99817 sends brownie points to @fdemaa :sparkles: :thumbsup: :sparkles:
style="background-color: white"
machinevision2020 sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 393 | @jtan3 |http://www.freecodecamp.com/jtan3
botenga sends brownie points to @kirontoo :sparkles: :thumbsup: :sparkles:
:cookie: 250 | @kirontoo |http://www.freecodecamp.com/kirontoo
vickylaiio sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 394 | @jtan3 |http://www.freecodecamp.com/jtan3
vickylaiio sends brownie points to @botenga :sparkles: :thumbsup: :sparkles:
:cookie: 124 | @botenga |http://www.freecodecamp.com/botenga
vickylaiio sends brownie points to @machinevision2020 :sparkles: :thumbsup: :sparkles:
:cookie: 119 | @machinevision2020 |http://www.freecodecamp.com/machinevision2020
atalaa sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:star2: 1010 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
atalaa sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:warning: atalaa already gave jdtdesigns points
<script type="text/javascript">
var canvas;
var cvasCntext;
window.onload=function()
{
canvas=document.getElementById('cArea'); cvasCntext=canvas.getContext('2d'); cvasCntext.fillStyle="black";
cvasCntext.fillRect(0,0,400,400);
cvasCntext.fillStyle='green';
cvasCntext.fillRect(25,0,100,100); cvasCntext.globalCompositeOperation='destination-over';//here my yellow rectangle disappears.I want my yellow rectangle to be visible and not overlap by black rectangle.
cvasCntext.fillStyle='yellow';
cvasCntext.fillRect(50,0,100,100);
cvasCntext.restore();
}
</script>
:cookie: 293 | @amitp88 |http://www.freecodecamp.com/amitp88
noobcoder007 sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 834 | @h1tag |http://www.freecodecamp.com/h1tag
sorry michielhuijse, you can't send brownie points to yourself! :sparkles: :sparkles:
osirisseye sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 835 | @h1tag |http://www.freecodecamp.com/h1tag
console.log(lat + long)
to test it
michielhuijse sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 836 | @h1tag |http://www.freecodecamp.com/h1tag
Hey guys! Iβve been pouring over this for hours and I canβt figure out what wrong. The console is printing out this error:
Uncaught TypeError: Cannot read property 'id' of undefined
at getUserIDs (VM409 pen.js:26)
at VM409 pen.js:47
getUserIDs @ VM409 pen.js:26
(anonymous) @ VM409 pen.js:47
//List of channels
var channelList = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
//Getting the user information using the list above
var getUser = function(){
var api = "https://cors-anywhere.herokuapp.com/https://wind-bow.gomix.me/twitch-api/users/";
var result = [];
for (var j = 0; j < channelList.length; j++){
$.getJSON(api+channelList[j],function(data){
result.push({
"id":data["_id"],
"username":data["display_name"],
"logo":data["logo"]
});
})
}
return result;
};
//Getting user IDs from the information we requested
function getUserIDs(users){
var IDs = [];
for (var i =0; i < channelList.length; i++){
IDs.push(users[i]["id"]);
}
return IDs;
}
//Getting the stream information from the userIds we collected
var getStream = function(userIDs){
var api = "https://cors-anywhere.herokuapp.com/https://wind-bow.gomix.me/twitch-api/streams/channel/"
var streamData = []
for( var i = 0; i < channelList.length; i++){
$.getJSON(api+userIDs[i], function(data){
streamData.push(data.stream[i]);
})
}
return streamData;
};
console.log(getStream(getUserIDs(getUser())));
return result
in the getUser
function, it outputs an array with 8 objects as it should?
result
inside getUser
?
oakypokey sends brownie points to @zhann1982 and @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 837 | @h1tag |http://www.freecodecamp.com/h1tag
:cookie: 326 | @zhann1982 |http://www.freecodecamp.com/zhann1982
oakypokey sends brownie points to @zhann1982 :sparkles: :thumbsup: :sparkles:
:warning: oakypokey already gave zhann1982 points
let
instead of var
in loops with your getjson
Hey guys. I'm building a pomodoro clock. I have a function, which is just two switch statements, that I can't get to work properly.
function checkNumLength(mins, seconds){
switch(seconds.toString().length){
case 1:
$('#countWindow').text(mins + ':0' + seconds);
console.log(mins + ':' + '0' + seconds);
break;
case 2:
$('#countWindow').text(mins + ':' + seconds);
console.log(mins + ':' + seconds);
break;
}
switch(mins.toString().length){
case 1:
$('#countWindow').text('0' + mins + ':' + seconds);
break;
case 2:
$('#countWindow').text(mins + ':' + seconds);
break;
}
return mins, seconds;
}
The idea of the switch statements is to check the length of two variables ('mins' and 'seconds') and then add a '0' in front of a single-numbered digit, similar to what a clock does. This works in the console (the console.logs output the correct value). However, the value displayed on the screen β at $('#countWindow') β always displays a single-digit number, like '25:0'; I want it to display '25:00'. Any ideas? Thanks. Also, for some reason, the minutes side seems to work well. The code is the same, so I'm confused as to what's going on.
robertridley1988 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 330 | @longnt80 |http://www.freecodecamp.com/longnt80
if
? It's shorter
if ( s < 10 ) { s = "0" + s; }
if ( m < 10 ) { m = "0" + m; }
if ( h < 10 ) { h = "0" + h; }
$('#countWindow').text(h + ':' + m + ':' + s);
yaroush sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @longnt80 |http://www.freecodecamp.com/longnt80
robertridley1988 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:warning: robertridley1988 already gave longnt80 points
background-color
setTimeout()
and the Date
object
setTimeout()
, it is more accuraterobertridley1988 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:warning: robertridley1988 already gave longnt80 points
1
millisecond to see the lag effect
sjurs1 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @longnt80 |http://www.freecodecamp.com/longnt80
$(document).ready(function(){
// https://en.wikipedia.org/w/api.php?action=opensearch&search=doggy&callback=?
$("#search").click(function(){
var searchTerm= $('#searchTerm').val();
$.ajax({
type:'GET',
url:'https://en.wikipedia.org/w/api.php?action=opensearch&search=' + searchTerm + '&callback=?',
contentType: "application/json; charset=utf-8",
async:false,
dataType:'json',
success:function(data){
$('#output').html('');
for(var i=0;i<data[1].length;i++){
$('#output').prepend("<div><div class='btn-primary'><a href="+data[3][i]+"><h2>" + data[1][i] + "</h2>" + "<p>" + data[2][i] + "</p></a></div></div>");
}
$("#searchTerm").val('');
},
error:function(errorMessage){
alert("ErrorMessage");
},
});
});
$("#searchTerm").keypress(function(e){
if(e.which==13){
$("#search").click();
}
});
});
$('h2 a').css('background-color', 'transparent')
got a question.
so i created a button with a <a>
but for some reason if i want to stytle the text inside the button i have to add the style directly in the <a>
if i remove the style and try to add it in the css it doesnt effect it
here is the button code <button class="btn-primary cmbtn"><a href="#" class="btnfont" style="font-family:'Lobster'; font-size:1.8em">Contact Me</a></button>
</div>
@priyanka-bhalla Your ajax call looks fine, but it could be simplified:
$.ajax({
url: "https://en.wikipedia.org/w/api.php?action=opensearch&origin=*&search=" + searchTerm,
success: function(data) {
Do you have a codepen? It's hard to tell what else might be going on - maybe an issue with IDs in your HTML
&
before format=json
https://en.wikipedia.org/w/api.php?action=opensearch&search=' + searchTerm + '&format=json&callback=?',
$.ajax({
url: "https://en.wikipedia.org/w/api.php?action=opensearch&origin=*&search=" + searchTerm,
success: function(data) {
I would change this:
$('h2 a').css('background-color', 'white')
To:
$('h2 a').css('background-color', '')
priyanka-bhalla sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1628 | @skyc0der |http://www.freecodecamp.com/skyc0der
btn-group
is meant for more than one button, your row needs a <div class="col"> inside of it, and the .buttonRow
class set up in your CSS is going to override the default bootstrap row CSS and possibly cause some issues with the btn-group
class.
<div class="btn-group btn-group-justified">
<div class="btn-group">
<button type="button" class="btn btn-primary">Apple</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">Samsung</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">Sony</button>
</div>
</div>
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css
swarmse sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1629 | @skyc0der |http://www.freecodecamp.com/skyc0der
$('span a').css('background-color','grey')
$('input').on('change', function () {
if ($(this).is(':checked')) {
var dt = $(this).data('title')
$('span a').css('background-color','grey')
$('#' + dt).css('background-color','orange')
console.log(dt)
}
})
$('input').prop('checked', false);
$('span a').css('background-color','grey')
$('input').prop('checked', false);
$('input').on('change', function () {
if ($(this).is(':checked')) {
var dt = $(this).data('title')
$('span a').css('background-color','grey')
$('#' + dt).css('background-color','orange')
console.log(dt)
}
})
$('body a').filter(function() {
console.log($(this).css('background-color'))
});
.addClass()
method for that: https://api.jquery.com/addclass/
.removeClass()
to remove the class
ericvoigt sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1630 | @skyc0der |http://www.freecodecamp.com/skyc0der
transform: translate(-50%, -50%);
transform: -webkit-translate(-50%, -50%);
transform: -moz-translate(-50%, -50%);
transform: -ms-translate(-50%, -50%);
?
transform: translate(-50%, -50%)
would move something left and up by 50%
saeedjassani sends brownie points to @alpox and @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1143 | @alpox |http://www.freecodecamp.com/alpox
:star2: 1631 | @skyc0der |http://www.freecodecamp.com/skyc0der
stream
variable isn't defined, and you'll want to avoid running async methods like getJSON inside a for loop. https://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript
alvin-capello sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1632 | @skyc0der |http://www.freecodecamp.com/skyc0der
$(document).ready(function(){
getFCC(); //first stream ajax call
getESLSC2(); //second stream ajax call
getEPICENTEREN1(); //third stream ajax call
$("#online").click(function(){
console.log($("#fccbox").val());
});
$("#all").click(function(){
$("div").slideDown();
});
});
hey guys, i need help. https://codepen.io/whdhli/full/jwPBgy/
there is something strange at the top, theres a rectangular block on top with image repetition, why is that so?
no-repeat center center fixed
to your background css
background:url("http://i.imgur.com/m36sYaY.jpg")no-repeat center center fixed;
whdhli sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 395 | @jtan3 |http://www.freecodecamp.com/jtan3
.val()
method is for <input> elements. Otherwise, you'll want to use .html()
to get the HTML inside that element or .text()
sjurs1 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1633 | @skyc0der |http://www.freecodecamp.com/skyc0der
class="img-responsive"
to your image element
maxmemphisjunior sends brownie points to @sjurs1 :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @sjurs1 |http://www.freecodecamp.com/sjurs1
maxmemphisjunior sends brownie points to @sjurs1 :sparkles: :thumbsup: :sparkles:
:warning: maxmemphisjunior already gave sjurs1 points
maxmemphisjunior sends brownie points to @fdemaa :sparkles: :thumbsup: :sparkles:
:cookie: 139 | @fdemaa |http://www.freecodecamp.com/fdemaa
maxmemphisjunior sends brownie points to @fdemaa :sparkles: :thumbsup: :sparkles:
:warning: maxmemphisjunior already gave fdemaa points
just put on css
h1
h2
etc
Mixed Content: The page at 'https://codepen.io/jrwoods42/pen/WObNRP?editors=1111' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.openweathermap.org/data/2.5/weather?lat=undefined&lon=undefined&appid=a3bd5ae4156214c3ebb1b5787d0b43a3'. This request has been blocked; the content must be served over HTTPS.
Hey, all.
trying to figure out why the text in my section named "about_me_container" is not staying within the container.
<div class="col-xs-4" style="float:none;">
<p>dlkfaldjflkajdklfakldjflkajsdlkfaslkdflkajdlfkakdsjflkajdlkfjaldlfjakldjfklakldjflkajldfjklajdklfjal</p>
</div>