Skip to content
View in the app

A better way to browse. Learn more.

RenCorner Network

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I center this?

Featured Replies

So I did an animation were whenever a mouse goes over the variable myName, (which is made out of squares) they all disperse with a cool animation. I was wondering if I wanted to use this on a website, how could I center it? Or use it after all my content (at the bottom of my page)

Thanks in advance

Something weird happened. Try this link http://pastebin.com/UgN0KAMj

Beware most of it is just walls of text of the Javascripts used so I can run it off of my computer locally, and not have to grab them from the web. The important part starts at line 20/

Edited by DrSithis
Merged post so the working Pastebin link was on the first post

Paste removed?

Fixed link.

It's been removed

Why wouldn't you make it so that the fucking HTML file isn't so large and do a javascript include? That's a bunch of useless crap that isn't needed on a webpage. It'll take a while to load the webpage, not only that you also have to think about the fact that how many people are actually going to see this? lol

  • Author

Line 20 is where all of that ends, and line 413 is where the code is

As I just stated you'll get more help IF YOU do as I said above. No one can read that mess.

 

Additionally you could properly write a better piece of javascript for that. -_-

Please don't tell me you have that javascript code on every html page you use. Actually, as far as I can tell you've included a bunch of different scripts in your html which is the most ridiculous thing I've ever seen; think of the cache, parallelism, etc.

 

As far as I can tell, you want to center something, please actually google before asking a new question: http://stackoverflow.com/questions/14883805/simple-center-a-object-with-css-and-no-hacks

 

If I haven't answered your question then clean up your code, use links that work and say explicitly what you want to know.

Not sure what you are trying to do here. You have the script in the wrong place. Most of that should be includes not in the document. Also there is no point in the footer tag. And you have nothing in the body of the webpage.

  • Author

Not sure what you are trying to do here. You have the script in the wrong place. Most of that should be includes not in the document. Also there is no point in the footer tag. And you have nothing in the body of the webpage.

 

The script is there for a temporary project. I was just wondering about the footer, and I'm going to add things in the body....

Well for future reference scripts go in the <head> tag.

The script is there for a temporary project. I was just wondering about the footer, and I'm going to add things in the body....

And this project is a waste of time. Why can't you use google as BillieJoe67 said? Most of what you want answered is already answered online. Not only that but again, you should get some proper code done instead of having all that bullshit. No one is going to help you if something is 200+ lines. There are scripts out there, I shit you not, that do the same function you want and they are under 20 lines.

 

Not only that but, you need to reconsider doing it all entirely. I'd write it up again for you but you are more than capable of doing it. Fix it up.

  • Author

I'm sorry.... As you can tell I'm not very good at this, that's why I asked for help.... I'm sorry....

 

I'll have this in main.js

var red = [0, 100, 63];var orange = [40, 100, 60];var green = [75, 100, 40];var blue = [196, 77, 55];var purple = [280, 50, 60];var myName = "Kyle Lindgren";var letterColors = [red, orange, green, blue, purple]if(420 > 69) {    bubbleShape = "circle";}else {    bubbleShape = "square";}drawName(myName, black);bounceBubbles()

And this as my Index.html

<!DOCTYPE html><html>  <head>    <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>    <script type="text/javascript" src="bit.ly/1dAojeQ"></script>  </head>  <body>    <canvas id="myCanvas"></canvas>    <script type="text/javascript" src="bit.ly/1dAojeQ"></script>    <script type="text/javascript" src="main.js"></script>  </body></html>

Did I do that correctly?

You should use the full url for those scripts (http://code.jquery.etc) and the last two script tags should be moved into the head section with the others. I would suggest that you look into the ready handler and make the calls to drawName and bounceBubbles in there so that it only happens once the browser has loaded everything.

 

Finally I wouldn't use shortened links in the actual code as you still won't use the browser cache effectively.

I suggest you make a jsfiddle with basic working code, then we can help you improve/develop your idea more effectively

Yea I am not sure what you are doing in the body there. If you want help tell us what you are trying to do. Right now it isn't going to show anything on the webpage. 

When I copy-paste, I at least try to understand how the herpderp code works (actually, I just don't copy-paste).

 I was feeling generous so I decided to write a working jsfiddle for this code. Upon googling code from bubbles.js I found this and this.

 

If you want to (slightly) redeem yourself, google centering a canvas and see if you can work it out.

 

tl;dr op stole code, claimed it was his, can't edit it

  • Author

When I copy-paste, I at least try to understand how the herpderp code works (actually, I just don't copy-paste).

 I was feeling generous so I decided to write a working jsfiddle for this code. Upon googling code from bubbles.js I found this and this.

 

If you want to (slightly) redeem yourself, google centering a canvas and see if you can work it out.

 

tl;dr op stole code, claimed it was his, can't edit it

I did a thing on codecademy, and wanted to use it for something else, that's why I was wondering how I could

You realise you can see exactly who wrote codeacademy articles? You are definitely not Lalith Polepeddi so please just give up pretending you wrote it from scratch.

 

This this works - I've tried it. If you have any sensible questions, I might be able to help you.

Create an account or sign in to comment

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.