Assembly Required

We all needed help with Grasshopper sometime. This topic is for my questions and any of your questions related to or caused by them.

1 Like

Well, time to start the list :joy:

1 Like

“I can’t scroll on the phone!”

  1. Go to learn.grasshopper.app.
  2. Go to Intro to Webpages.
  3. Make the code output make content go farther down the phone screen to the right.
  4. Try scrolling.

One advantage of talking to yourself is that you know at least somebody’s listening.

3 Likes

“I can’t do other files than JS! Are you crazy?”

  1. Go to learn.grasshopper.app.
  2. Go to Playground.
  3. Try to add a non-JS file.

One advantage of talking to yourself is that you know at least somebody’s listening.

2 Likes

too true!!!

1 Like

I cannot scroll on the phone that displays the webpage either…

1 Like

Hey there, I’m happy to say we’ve just fixed this bug! It should be released in the next few days or so.

1 Like

Awesome thanks a bunch!

1 Like

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

2 Likes

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?

1 Like

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);
1 Like

How do I find the link for my snippet?

1 Like

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!

1 Like