We all needed help with Grasshopper sometime. This topic is for my questions and any of your questions related to or caused by them.
Well, time to start the list
“I can’t scroll on the phone!”
- Go to learn.grasshopper.app.
- Go to Intro to Webpages.
- Make the code output make content go farther down the phone screen to the right.
- Try scrolling.
One advantage of talking to yourself is that you know at least somebody’s listening.
“I can’t do other files than JS! Are you crazy?”
- Go to learn.grasshopper.app.
- Go to Playground.
- Try to add a non-JS file.
One advantage of talking to yourself is that you know at least somebody’s listening.
too true!!!
I cannot scroll on the phone that displays the webpage either…
Hey there, I’m happy to say we’ve just fixed this bug! It should be released in the next few days or so.
Awesome thanks a bunch!
I’m happy to hear that the bug has been fixed. But what about adding an html or css in playground on a computer?
If I make a playground snippet public, do I have to share a link to everyone that wants to see it?
Hey there, correct. You’ll have to share the link, and the snippet must be marked as Public.
We’re still adding features to the code playground on our website, you can use JavaScript to add HTML and CSS, like this:
let css = `
body {
background-color: blue;
font: 10pt arial, sans-serif;
text-align: center;
}
h1 {
color: white;
}
`
let style = document.createElement('style');
style.innerHTML = css;
document.body.appendChild(style);
let header = document.createElement('h1');
header.textContent = 'Hello world';
document.body.appendChild(header);
Hope this helps!
Ben
For Grasshoppers:
Do you think Grasshopper will have lessons for coding languages like Python or JSON?
For Staff:
Will or do you think Grasshopper will have lessons for coding languages like Python or JSON?
Grasshoppers:
- Yes, and more
- Yes
- Only Python
- Only JSON
- Only others
- No
- No, and none
- I don’t know
0 voters
Staff:
- Yes, and more
- Yes
- Only Python
- Only JSON
- Only others
- No
- No, and none
- I don’t know
0 voters
Summary
Will there be more of Intro to Webpages? If so, will they have head tags?
Thanks! I made this piece of code:
Code
let css = `
body {
background-color: white;
font: 10pt arial, sans-serif;
text-align: center;
}
h1 {
color: black;
}
`;
let style = document.createElement('style');
style.innerHTML = css;
document.body.appendChild(style);
let header = document.createElement('h1');
header.textContent = 'Hello world';
document.body.appendChild(header);
let button = document.createElement('button');
let theme = 'white';
button.addEventListener('click', () => {
if (theme === 'white') {
css = `
body {
background-color: black;
font: 10pt arial, sans-serif;
text-align: center;
}
h1 {
color: orange;
}
`;
style.innerHTML = css;
document.body.appendChild(style);
theme = 'black';
button.textContent = 'Theme is: ' + theme;
} else {
if (theme === 'black') {
css = `
body {
background-color: white;
font: 10pt arial, sans-serif;
text-align: center;
}
h1 {
color: black;
}
`;
style.innerHTML = css;
document.body.appendChild(style);
theme = 'white';
button.textContent = 'Theme is: ' + theme;
}
}
});
button.textContent = 'Theme is: ' + theme;
document.body.appendChild(button);
How do I find the link for my snippet?
Hey there, currently there isn’t a link, but soon we’ll be adding this. Once that’s launched, you can just share the URL of your snippet. As long as that snippet is marked “public”, it will be sharable.
I can’t give a specific date as to when this feature will launch, but it should be a few weeks or so. In the meantime, you can keep working on snippets!