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
Stephen James
@sjames1958gm
$("html").css("background-image", 'url(' + imgurl + ')');
William Cabell
@wbac88
Hmm, ok I'll try that out!
@sjames1958gm Could you give an example with a random URL in there?
NM, I have this: $("html").css("background-image", "url('https://static.pexels.com/photos/110874/pexels-photo-110874.jpeg')");
is the punctuation right?
Stephen James
@sjames1958gm
@wbac88 I don't think you need the single quotes
My single quotes were there because I was concatenating a variable
William Cabell
@wbac88
It ends up commenting it out if I have double quotes in there
Stephen James
@sjames1958gm
$("html").css("background-image", "url(https://static.pexels.com/photos/110874/pexels-photo-110874.jpeg)")
William Cabell
@wbac88
Ahh, ok, that's what I was missing, I see what you mean. I'll try it.
It's not showing up as a background. Just white
Stephen James
@sjames1958gm
hmm
William Cabell
@wbac88
I've been working on this for weeks, I can't get anything to show up right, I don't understand it.
Luis Felipe López G.
@luishendrix92
@wbac88 Try with body instead of html
Stephen James
@sjames1958gm
@wbac88 I see the bottom of the image
@luishendrix92 :+1:
Luis Felipe López G.
@luishendrix92
I'd normally do:
document.body.style.background = 'url("' + imgUrl + '")';
William Cabell
@wbac88
Thanks @luishendrix92 Yep that did it! Thanks @sjames1958gm for your help!
Thought I'd tried that before but obviously not!
CamperBot
@camperbot
:cookie: 827 | @luishendrix92 |http://www.freecodecamp.com/luishendrix92
wbac88 sends brownie points to @luishendrix92 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2240 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
William Cabell
@wbac88
@luishendrix92 I see, that makes sense.
William Cabell
@wbac88

If anyone else is still here, I have another question:

      //Temperature
      var celsius = where.main.temp - 273.15;

      var fahrenheit = where.main.temp * 1.8 - 459.67;

      $("#temperature").html("<p id = 'celFahr'>Current Temperature: " + Math.floor(celsius) + "<span id='changeToFahr'> &#8451</span></p>")

      var tempCel = true;

      //Celsius to Fahrenheit
      $("#changeToFahr").click(function() {
      if (tempCel == true){ 

        tempCel = false;
        console.log(tempCel);
        $("#celFahr").html("<p id = 'celFahr'>Current Temperature: " + Math.floor(fahrenheit) + "<span id='changeToFahr'> &#8457</span></p>")

      }
      else if (tempCel == false) {

        tempCel == true;
      console.log(tempCel);

        $("#celFahr").html("<p id = 'celFahr'>Current Temperature: " + Math.floor(celsius) + "<span id='changeToFahr'> &#8451</span></p>")

      };
      });

When I click the C on my site, it switches it to Fahrenheit, but it won't switch back when I click the F, so something is missing here and I can't see it.

Ken Haduch
@khaduch
@wbac88 - kind of hard to tell, but if you are changing the structure of the HTML, and regenerating the <span id='changeToFahr'>, you might be losing the click handler on that element?
William Cabell
@wbac88
@khaduch OK, would there be an easier way to do this?
Luis Felipe López G.
@luishendrix92
@wbac88 When you re-render an html element you lose the handler
don't include the button or span to change the temperature in any re-rendering process
Ken Haduch
@khaduch
@wbac88 - well, don't re-generate that element that you are putting the click handler on, just change the text of it?
Luis Felipe López G.
@luishendrix92
it should stay separated
William Cabell
@wbac88
Hmm ok, thanks @luishendrix92 @khaduch, let me go re-work that. I appreciate it!
CamperBot
@camperbot
wbac88 sends brownie points to @luishendrix92 and @khaduch :sparkles: :thumbsup: :sparkles:
:warning: wbac88 already gave luishendrix92 points
:star2: 1497 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@wbac88 - you're welcome.
Luis Felipe López G.
@luishendrix92
@wbac88 Instead of changing the whole HTML, you can change the text content of the paragraph with the ID of celFahr using .text(' new text') in jQuery or .textContent in vanilla js
Xavier Velez
@JonSnow08
@khaduch you got a second to help me figure out why my simon game won't work?
@khaduch i've been at it for 3 days now and I just can't figure it out
William Cabell
@wbac88
@luishendrix92 It's working now, thank you!
CamperBot
@camperbot
wbac88 sends brownie points to @luishendrix92 :sparkles: :thumbsup: :sparkles:
:cookie: 828 | @luishendrix92 |http://www.freecodecamp.com/luishendrix92
Xavier Velez
@JonSnow08
or if anybody has some helpful tips I'd appreciate it, I can't seem to figure it out
JD Tadlock
@jdtdesigns
@JonSnow08 You have about 100 errors in your js regarding .css()
for a single css declaration, you use .css('background-color', 'red');
for multiple use
.css({
'background-color': 'red',
'color': 'blue'
}):
Xavier Velez
@JonSnow08
@jdtdesigns ahhhh ok
JD Tadlock
@jdtdesigns
@JonSnow08 There are numerous errors. You need to look at the browser console(ctrl/cmd + shift + j).
Everytime i fix one, there is another
Xavier Velez
@JonSnow08
@jdtdesigns okay I will
JD Tadlock
@jdtdesigns
It's good practice to have a console up to see any errors as you save and refresh