kevinkuehler sends brownie points to @octopinky :sparkles: :thumbsup: :sparkles:
:cookie: 130 | @octopinky |http://www.freecodecamp.com/octopinky
So, I can't figure out why my hamburger will not work. It collapses fine but will not open.
`<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/500602/Logo.png" alt="logo" id="logo" /></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div>
</nav>`
tbc13315 sends brownie points to @octopinky :sparkles: :thumbsup: :sparkles:
:cookie: 131 | @octopinky |http://www.freecodecamp.com/octopinky
@tbc13315 your jquery is working (to check, add this line of code inside you document ready function)
$(".wiki").css("color", "red");
which means, that the mistake is in the code.
$("#searching").keypress(function(event) {
if (event.which == 13) {
searchWiki();
return false;
}
});
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
startSearch();
}
$.getJSON(api, function(data){
// do something with data here
});
i am on "Target Elements by Class Using jQuery" i cant get my "well" elements to shake like the lesson is trying to have me do. this is what i have above the provided lesson code
<script>
$(document).ready(function() {
$("button").addClass("animated bounce");
$("well").addClass("animated shake");
});
</script>
<script>
$(document).ready(function() {
$("button").addClass("animated bounce");
$("well").addClass("animated shake")
});
</script>
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
trayuk sends brownie points to @snexus :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @snexus |http://www.freecodecamp.com/snexus
shift
+ enter
provides additional line feeds (space for posting/pasting code).```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
This an inline `<paste code here>
` code formatting with a single backtick() at _start_ and _end_ around the
code`.
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
octopinky sends brownie points to @snexus :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @snexus |http://www.freecodecamp.com/snexus
margin-bottom:-60px;
$("#submitButton").on("click", function(){
$.getJSON(apiLink, function(data){
var articleLink = data;
var articlePreview = data;
for (i =0; i < array.length; i++){
//dunno what you are trying to do here ------>$("<a href = apiLink>apiPreview.slice(0,20)</a></br><p>articlePreview.slash(0,100)</p></br>").appendTo(".wikiArticles");
//i guess you did the reverse
//remember to use the selector to get access to the element then append the html you build
$(".wikiArticles").append("<a href = apiLink>"+apiPreview.slice(0,20)+"</a></br><p>"+articlePreview.slash(0,100)+"</p></br>");
};
});
});
$(document).ready(function() {
$.getJSON("http://ipinfo.io", function(response) {
$(".location").html(response.city + ", " + response.region + ", " + response.country);
var zip = response.postal;
var country = response.country;
$.getJSON("http://api.openweathermap.org/data/2.5/weather?zip=" + zip + "," + country + "&APPID=4ca247b54b4eb71e942ca40585468d7d", function(json) {
var K = json.main.temp;
var F = Math.round((K - 273.15) * 9 / 5 + 32);
var C = Math.round(K - 273.15);
$(".weather").html(JSON.stringify(F) + " °" + '<span id="unit">' + "F".fontcolor("yellow") + "</span>");
//???when then or done
$("#unit").toggle(function() {
$(".weather").html(JSON.stringify(F) + " °" + '<span id="unit">' + "F".fontcolor("yellow") + "</span>");
}, function() {
$(".weather").html(JSON.stringify(C) + " °" + '<span id="unit">' + "C".fontcolor("yellow") + "</span>");
});
});
});
});
bomholt sends brownie points to @sorinr and @kevinkuehler and @kirbyedy :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @kevinkuehler |http://www.freecodecamp.com/kevinkuehler
:star2: 1190 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
:cookie: 429 | @sorinr |http://www.freecodecamp.com/sorinr
$("#your button").click(function() {
$(".fahrenheit").toggle();
$(".celsius").toggle();
});
designbuildshipsoftware sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1192 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
http://codepen.io/meetmangukiya/full/WxOEWW/
Jumping over an element with a given ID when clicking on a link doesn't work in full page view, why ? Try pressing the Contact
button and it should take you to the lorem text. But it doesnt :confused:
@sorinr
Try pressing the Contact button and it should take you to the lorem text. But it doesnt
sorinr sends brownie points to @microcyberz :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @microcyberz |http://www.freecodecamp.com/microcyberz
susangapper sends brownie points to @fourbits :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @fourbits |http://www.freecodecamp.com/fourbits
@d1sr3
$.ajax({
url: 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=',
success: function(response) {
console.log(response);
}
});
worked for me
if (true){
return false;
}
susangapper sends brownie points to @fourbits :sparkles: :thumbsup: :sparkles:
:warning: susangapper already gave fourbits points
http
instead of https
because the browsers think it's unsafe to access one from the other.
d1sr3 sends brownie points to @fourbits :sparkles: :thumbsup: :sparkles:
:cookie: 339 | @fourbits |http://www.freecodecamp.com/fourbits
gauravtolani sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1193 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
location.protocol
and using the same protocol to get your JSON; however, some sites only accept one protocol, so it doesn't always work.
I'm working on the "Twitch.TV JSON" api project. I'm just testing the api right now and various data pieces of display in a test div. So, I can then play with the API. Its not displaying anything however.
Here is the code: http://codepen.io/flindip/pen/bZRANL
see my output should be coming like
[1 2 3]
[4 5 6]
[7 8 9]
But it's coming like
[
1
2
3
]
[
1
2
3
]
[
1
2
3
]
@susangapper
```js ⇦ Type 3 backticks and then press [shift + enter ⏎]
(type js or html or css)
<paste your code here>,
then press [shift + enter ⏎]
``` ⇦ Type 3 backticks, then press [enter ⏎]
This an inline `<paste code here>
` code formatting with a single backtick() at _start_ and _end_ around the
code`.
See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics
console.log(j+i*3);
sainiabhi sends brownie points to @susangapper :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @susangapper |http://www.freecodecamp.com/susangapper
:bulb: to format code use backticks! ``` more info
var url = 'https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=' + searchTerm + '&callback=?';
//Also works
var jqxhr = $.getJSON(url, function(r) {
//console.log("success: " + JSON.stringify(r));
displaySearchResults(r)
})
.fail(function() {
console.log("error");
});
i-liszt sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1637 | @moigithub |http://www.freecodecamp.com/moigithub
@i-liszt like @moigithub says, seems it's the parameters. this works with your structure: ``` function Search() {
var url = 'https://en.wikipedia.org/w/api.php';
var keyword = $("#keyword").val();
$.ajax({
url: url,
data: {
action: 'query',
list: 'search',
srsearch: keyword,
format: 'json'
},
dataType: 'jsonp',
success: Query
});
} ```
i-liszt sends brownie points to @moigithub and @susangapper and @marcvesper :sparkles: :thumbsup: :sparkles:
:warning: i-liszt already gave moigithub points
:cookie: 285 | @marcvesper |http://www.freecodecamp.com/marcvesper
:cookie: 266 | @susangapper |http://www.freecodecamp.com/susangapper
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
// Only change code above this line
return product * multiplyAll(arr);
}
// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
cyas87 sends brownie points to @konikodes :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @konikodes |http://www.freecodecamp.com/konikodes
konikodes sends brownie points to @cyas87 :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @cyas87 |http://www.freecodecamp.com/cyas87
cyas87 sends brownie points to @konikodes :sparkles: :thumbsup: :sparkles:
:warning: cyas87 already gave konikodes points
sevohan sends brownie points to @jake-thewoz and @moigithub and @konikodes :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @jake-thewoz |http://www.freecodecamp.com/jake-thewoz
:cookie: 323 | @konikodes |http://www.freecodecamp.com/konikodes
:star2: 1641 | @moigithub |http://www.freecodecamp.com/moigithub
:cookie: 286 | @marcvesper |http://www.freecodecamp.com/marcvesper
brascene sends brownie points to @marcvesper :sparkles: :thumbsup: :sparkles:
VM660:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
click on the link at the right to see what you get back
@mpettaw2 - you have a few problems in your code, but it is basically working - I made this change at the start of your success
function:
success: function(json) {
console.log(json);
//var jsonish = JSON.parse(json);
var author = json.author;
var qoute = json.quote;
var html = "<h1>" + author + "</h1><br><p>" + qoute + "</p>";
$(html).appendTo("#msg");
console.log("api working");
},
And got some output from the quote that was returned.
You also have "QUOTE" misspelled in several places - one of which was causing a failure to read from the returned object.
I hope that helps?
var author = json.author;
var qoute = json.quote;
is sufficient to fetch the author and quote from the object.
Help me with this palindrome challenge here, please.
function palindrome(str) {
// Good luck!
var normal = str.replace('/[^a-zA-Z]/gi', '').toLowerCase();
var rev = str.replace('/^[A-Z]+$/gi', '').split('').reverse().join('').toLowerCase();
if(rev.split('').reverse().join('') === normal){
return true;
}
else if(rev.split('').reverse().join('') !== normal){
return false;
}
}
Here's my code.
me with this palindrome challenge here pleasefunction palindromestr good luckvar normal strreplacea-za-zgi tolowercasevar rev strreplacea-zgi splitreversejointolowercaseifrevsplitreversejoin normalreturn trueelse ifrevsplitreversejoin normalreturn falseheres my code
normal
then compare it to the non-reversed version otherwise if your regex is different they wont be the same
//need to improve regex
var normal = str.replace('/[^a-zA-Z]/gi', '').toLowerCase(); //only need to perform .replace once
var rev = normal.split('').reverse().join('');//<----normal is already lower case
//on the if test rev and normal are strings so no need to use .join and .reverse
@wearenotgroot Yup, I've been trying. I used filter before doing this, it returned true for every palindrome, didn't return false for non-palindromes.
I've been getting that same result again and again. These are the methods that I've tried till now.
Method 1 :
for
loop and then decapitalized everything.Method 2 :
Used .replace
to do similar thing
Method 3 :
Used .filter
to do similar thing. Used this : /^[A-Z]+$ /gi
to get all the wanted characters.
Doesn't work even after removing the + from regex.
/[\W_]/g
<-----------this guy didnt work?
The conditions where spaces or numeric or special characters are involved and if they should return true, return true.
@wearenotgroot Yup, that one too. Just checked it again.
function palindrome(str) {
// Good luck!
var normal = str.replace('/[\W_]/g', '').toLowerCase();
var rev = str.replace('/[\W_]/g', '').split('').reverse().join('').toLowerCase();
if(rev.split('').reverse().join('') === normal){
return true;
}
else if(rev.split('').reverse().join('') !== normal){
return false;
}
}
palindrome("");
var normal = str.replace(/[\W_]/g, '').toLowerCase(); //should be like
normal
to rev
and return the result? Your other code at the bottom looks like you're reversing the reversed string again? that's not necessary, besides being incorrect...
@a-y-u-s-h aslo as mentioned earlier there is no point on repeating the same operation
var normal = str.replace(/[\W_]/g, '').toLowerCase(); //only need to perform .replace once
var rev = normal.split('').reverse().join('');
so just take the normal variable and reverse it
@wearenotgroot Updated . WORKS NOW. THANKS. -.-" silly mistakes. Consumed my whole day.
@khaduch Yup, correct. WORKS NOW. Thanks.
a-y-u-s-h sends brownie points to @wearenotgroot and @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1402 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1204 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
freecodecamp
is OFFLINE?
spot1000 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1403 | @khaduch |http://www.freecodecamp.com/khaduch
stephepush sends brownie points to @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @spot1000 |http://www.freecodecamp.com/spot1000
hristijankiko sends brownie points to @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 318 | @spot1000 |http://www.freecodecamp.com/spot1000
woofiewilly sends brownie points to @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 319 | @spot1000 |http://www.freecodecamp.com/spot1000
lukenetti3 sends brownie points to @hristijankiko and @spot1000 :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @spot1000 |http://www.freecodecamp.com/spot1000
:cookie: 296 | @hristijankiko |http://www.freecodecamp.com/hristijankiko
lukede sends brownie points to @hristijankiko and @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 384 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
:cookie: 297 | @hristijankiko |http://www.freecodecamp.com/hristijankiko
<style>
body {background color: gray;}</style>
not working. why?
background-color
ssaabbiirr sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:cookie: 600 | @dagman |http://www.freecodecamp.com/dagman
debug
mode on CodePen - it works! It has to do with the sandboxing within CodePen, apparently. Just replace the full
in the URL with debug
and try it.
font-weight: bold
use this as reference if you are new to css http://www.w3schools.com/css/css_font.asp
@svadali2 - one thing that you need to do, maybe the only thing? - is to save the value that is returned when you call setInterval
, because you need that value to be able to stop the interval, that is the value that has to be passed to clearInterval()
.
Well, there is another thing that you have to do - if I click on your timer button multiple times, it seems that it also starts multiple interval timers, so that the timer then runs much more rapidly and then you won't be able to stop it. You need to save the return from setInterval, and make sure that you do not start another setInterval()
while the clock is running. (Perhaps if you get your pause function running, it will be handled there, depending on how your logic is designed.)
Another helpful thing - I changed the session and break timers to 1
, but the timer still started at 15:00
.
One more thing - it simplifies the logic of the timer countdown if you keep your time value only in seconds, then you don't have to try and track minutes and seconds separately. You can just convert the seconds to a mm:ss
value for output.
I hope that helps...
$(document).ready(function() {
//Get search results on 'submit' event
$('#regSearch').on('click', function() {
var query = $('#searchBar').text();
$.getJSON('https://jsonp.afeld.me/?callback=?&url=https://en.wikipedia.org/w/api.php?action=query&format=json&titles=' + query, function(json) {
var result = json;
alert(result);
});
});
});
event.preventDefault()
jamessral sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
event
is parameter to click handler function @jamessral
$(something).on('click', function(e) {
e.preventDefault();
//other stuff
});
svadali2 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1404 | @khaduch |http://www.freecodecamp.com/khaduch
vvkgdm sends brownie points to @adventurebear :sparkles: :thumbsup: :sparkles:
:cookie: 449 | @adventurebear |http://www.freecodecamp.com/adventurebear
html, body {
background-color: #fafafa;
font-family: 'Verela Round', sans-serif;
text-align: center;
}