Evo Posted May 15, 2014 Posted May 15, 2014 (edited) 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 advanceSomething weird happened. Try this link http://pastebin.com/UgN0KAMjBeware 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 May 22, 2014 by DrSithis Merged post so the working Pastebin link was on the first post
DrSithis Posted May 16, 2014 Posted May 16, 2014 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 1
Strike Posted May 16, 2014 Posted May 16, 2014 Well since the code is all nearly put on 1 line, its unreadable..
Evo Posted May 16, 2014 Author Posted May 16, 2014 Line 20 is where all of that ends, and line 413 is where the code is
DrSithis Posted May 16, 2014 Posted May 16, 2014 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.
BillieJoe67 Posted May 16, 2014 Posted May 16, 2014 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. 1
Volcom Posted May 16, 2014 Posted May 16, 2014 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. 2
Evo Posted May 16, 2014 Author Posted May 16, 2014 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....
Volcom Posted May 16, 2014 Posted May 16, 2014 Well for future reference scripts go in the <head> tag.
DrSithis Posted May 16, 2014 Posted May 16, 2014 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.
Evo Posted May 17, 2014 Author Posted May 17, 2014 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? 1
BillieJoe67 Posted May 17, 2014 Posted May 17, 2014 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
Volcom Posted May 17, 2014 Posted May 17, 2014 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.
BillieJoe67 Posted May 18, 2014 Posted May 18, 2014 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 1
Evo Posted May 18, 2014 Author Posted May 18, 2014 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
BillieJoe67 Posted May 18, 2014 Posted May 18, 2014 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now