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
Jenn Hardy
@smokeyLilac
At the top of my code @kurzninja ?
Brett Guillory
@kurzninja
Well there's the CSS you have to include at the top
and then I believe there's also some Javascript you have to include near the bottom of your code
if you're doing this in Codepen, all you have to do is select it in the CSS tab, I believe it will automatically include the Javascript as well if you do
if you're not in codepen, just check out here:
http://getbootstrap.com/getting-started/
Jenn Hardy
@smokeyLilac
I did that @kurzninja
Bruce Young
@mutantspore
no you’ll need to add the bootstrap.js yourself in the JS cog
Jenn Hardy
@smokeyLilac
It's been there since I first started the page
Brett Guillory
@kurzninja
@mutantspore seriously? That seems awfully shortsighted of Codepen to include the css without the js too :(
Jenn Hardy
@smokeyLilac
@mutantspore do I put that in under add classes to <html>?
Bruce Young
@mutantspore
yes you have to do it yourself.. a very very common issue on this help line
no just go to where you added jquery
and add in bootstrap.js too
Jenn Hardy
@smokeyLilac
So under the javascript cog?
Bruce Young
@mutantspore
yes
add it after jquery as it’s dependant on that
Jenn Hardy
@smokeyLilac
Ok I did that... it didn't change anything on my page
Bruce Young
@mutantspore
maybe not but it’s is necessary for bootstrap to function correctly
Jenn Hardy
@smokeyLilac
Ok thanks @mutantspore
CamperBot
@camperbot
jennhardy sends brownie points to @mutantspore :sparkles: :thumbsup: :sparkles:
:star: 1108 | @mutantspore | http://www.freecodecamp.com/mutantspore
Matt Leonard
@matty22
Need some help with my Local Weather app. I'm using a .click() function to create the toggle between C and F. However I can't put that inside the function that gets geolocation and parses out the API weather object or I get function not defined errors in the console. So I need to get the weather object out to the global scope. Here's some code to assist:
//var apiKey = 810a0a8ee3d2a52f12f66932cfe8cf0c;

$(document).ready(function(){

    navigator.geolocation.getCurrentPosition(function(position) {
        var lat = position.coords.latitude;
        var lon = position.coords.longitude;

        //Currently my currentTemp is hardcoded to degrees F. I can't put my onclick function inside of here or I get a function not defined error.
        //But I need to get the object data out to the global scope to use in other parts.
        $.getJSON("http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&APPID=810a0a8ee3d2a52f12f66932cfe8cf0c", function(json) {
            var weatherObj = json;
            var iconURL = "http://openweathermap.org/img/w/" + weatherObj.weather[0].icon + ".png"
            var currentTemp = Math.round(weatherObj.main.temp * 9/5 - 459.67);
            var imgPath;

            if (currentTemp >= 40) {
                imgPath = "img/pennyfarthing.jpg";
            } else {
                imgPath = "img/manOnBus.jpg";
            }

            document.getElementById("currentCity").innerHTML = weatherObj.name;
            document.getElementById("tempBlock").innerHTML = currentTemp + "&deg; F";
            $("#weatherIcon").html("<img src=" + iconURL + ">");   
            document.getElementById("bikeOrBusImg").src = imgPath; 
        });   
    });

});

//Toggle switch for F or C
function setUnits() {
    if($('#cmn-toggle-7').prop('checked')) {
        var currentTemp = Math.round(weatherObj.main.temp * 9/5 - 459.67);
        console.log(currentTemp);
        document.getElementById("tempBlock").innerHTML = currentTemp + "&deg; F";
    } else {
        var currentTemp = Math.round(weatherObj.main.temp - 273);
        console.log(currentTemp);
        document.getElementById("tempBlock").innerHTML = currentTemp + "&deg; C";
    }
}

//Set Date in UI to current date in user's location and format it nicely
var date = new Date().toDateString();
var dateArr = date.split(" ");
document.getElementById("date").innerHTML = dateArr[1] + " " + dateArr[2];



//Ping for the minute each second and update if necessary. Makes the clock functional in real time
//Set time in UI to current time
//Need to account for when the hour == 00
setInterval(function(){

    var hour = new Date().getHours();
    var amPm = "a";

    if (hour > 12) {
        hour -= 12;
        amPm = "p"
    }

    var minute = new Date().getMinutes();
    //If minute is less than 10, prepend a 0
    if (minute < 10) {
        minute = "0" + minute;
}

document.getElementById("time").innerHTML = hour + ":" + minute + amPm;}, 1000);
Salman Shahid
@salman-shahid
Wait..so bootstrap has a function to center rows?
Utkarsh Bhimte
@Utkarshbhimte
I have been stuck in Wikipedia search for days now
I want to get this https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=india&callback=JSON_CALLBACK, this is what used in fcc sample pen
but I came out with this https://en.wikipedia.org/w/api.php?action=opensearch&search=india&namespace=0&format=jsonfm. I am even unable to operate on the first one coz 'No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.'
Bruce Young
@mutantspore
@JennHardy the following is not meant to be negative…
I did have a look at your code when you first put it up a while ago but it was pretty messy and had a lot of wrong things in it so it was very hard to see what was wrong as a lot would have to be fixed. for example you had multiple id tags teh same (you can only have one of each). you have id’s in your div closing tags etc .. I got a headache and closed it . I also see you have used Imgur for your images… they don’t come up for me. It’s been a very common issue for campers. try http://postimage.org instead.
Jenn Hardy
@smokeyLilac
Ok thanks for the feedback @mutantspore ... I waited too long to ask for help from others so that's how it ended up in a mess! I couldn't get postimage to work at all when I tried. They won't let me set up a password, then tell me to enter my email address and it sends me in a loop asking for my password then not letting me set one up
CamperBot
@camperbot
jennhardy sends brownie points to @mutantspore :sparkles: :thumbsup: :sparkles:
:warning: jennhardy already gave mutantspore points
Alex Evans
@alex-evans
Hi, I just finished the "Symmetric Difference" challenge but I feel there should be a better solution than the mess I came up with. Can someone let me know if there is a better way to approach that challenge or give me any pointers? I don't like how I have multiple for loops and ifs. Thanks.
function sym(args) {
  var chkArr = [];
  for(i=0; arguments.length > i; i++) {
    chkArr.push(arguments[i]);
  }

  var symArr = chkArr.reduce(function(prev,cur) {

    var rtnArr = [];
    for(j=0; cur.length > j; j++) {
      if(prev.indexOf(cur[j]) < 0) {
        if(rtnArr.indexOf(cur[j]) < 0) {
          rtnArr.push(cur[j]);
        }
      }
    }

    for(k=0; prev.length > k; k++) {
      if(cur.indexOf(prev[k]) < 0) {
        if(rtnArr.indexOf(prev[k]) < 0) {
          rtnArr.push(prev[k]);
        }
      }
    }

    return rtnArr;

  }, []);

  return symArr;
}
Salman Shahid
@salman-shahid
What is the group name for things like: class, role, id, style, href?
Like what do you call them? e.g. "element properties" are the style something's attribute.
Brett Guillory
@kurzninja
it depends on the context
in an HTML tag, those would be attributes
in CSS, some of those are considered selectors
Salman Shahid
@salman-shahid
Ok, I'm trying to add an attribute to an element by id using jQuery. Here's what I've got so far:
      var elemID = ($(".ops:nth-child(" + (childCount - 1) + ")").prop('id'));
      $("#" + elemID).prop("OnClick", elemID + "Press()");
elemID works and returns ac
It should evalute out to:
$(#ac).prop("OnClick", "ac" + "Press()");
but the OnClick="acPress()" attribute is never added to the element.
faintlywonky
@faintlywonky
Hello fellow coders. I just got to the Basic Front End Development section but when I follow the instructions for signing up for CodePen, I do not get a "Use info from GitHub" button. Can I go ahead without it, or will it cause me trouble later?
Salman Shahid
@salman-shahid
It shouldn't cause a problem @faintlywonky
Brett Guillory
@kurzninja
@mynameissal try .attr() instead of .prop
faintlywonky
@faintlywonky
@mynameissal ok, thanks, I'll try it.
CamperBot
@camperbot
faintlywonky sends brownie points to @mynameissal :sparkles: :thumbsup: :sparkles:
:star: 286 | @mynameissal | http://www.freecodecamp.com/mynameissal
Brett Guillory
@kurzninja
since it's a jQuery object, why don't you just add it as an event listener instead of adding it in the HTML?
Andrew Charlebois
@andrewchar
hey campers.
Brett Guillory
@kurzninja
@mynameissal
mutantspore @mutantspore hides