1
vote
2answers
34 views

Series of repetitive content-loading functions

A friend helped me put the following code together. As can be seen, it's made up of a series of repetitive loadContent() functions. I've just shown the first two ...
2
votes
0answers
142 views

jQuery animate opacity, fade, & slide up page load effect

This is the first time I've actually made my own jQuery script from scratch, because I couldn't find exactly what I was looking for. My code works how I want it to, although I don't know if I did it ...
4
votes
2answers
56 views

Page loader function

This is the function which I wrote and am currently using in my project. I want to know if there is a better way to write it: ...
4
votes
1answer
80 views

Fix base64 data URI scripts function

So I noticed Chrome has quirky behaviour when it encounters script tags whose src is a base64 value. I decided to write a quick ...
0
votes
2answers
48 views

Trying to convert an extended Array.prototype to a function

I got a random image rotator working by using the following script (demo). But I was told that it is a bad practice to extend Array.prototype. And it does. It ...
1
vote
1answer
42 views

Reducing multiple function calls [closed]

I can't quite figure out the best way to approach this. So I have a validation function that contains various other functions inside of it for validating email, phone and zip. This works fine but it ...
2
votes
2answers
151 views

Deeper abstracting of code into functions

I created a quiz using the module pattern. My code is as follows: ...
2
votes
1answer
278 views

Refactoring this state machine (upvoting/downvoting)

I have a list of resources which can be voted on. There are 3 voting states: upvoted, downvoted and no vote. In a fashion identical to stackexchange voting, it follows these rules: If you upvote a ...
3
votes
1answer
3k views

How can I shorten my jQuery for Show/Hide Function with Multiple Div IDs?

I've created a sliding panel menu that works (JSFiddle: http://jsfiddle.net/stephmoreland/3BT7t/), but I can't wrap my head around shortening the jQuery for it. Right now, when you click one of the ...
1
vote
2answers
713 views

calling functions over and over?! improvements needed

Not some much a problem, I am curious to know if my code can be cleaned up here a little. One annoyance is im calling a function three ( 3 ) times. I would like to know how this could be improved, ie: ...
1
vote
2answers
3k views

Setting variables inside if / else-if statment blocks

I have written the code below and I am trying to work out if there is a more efficient way of doing it: i.e. less lines of code and quicker etc. I am also wondering whether it is OK to declare ...
5
votes
2answers
2k views

Do I always have to return something in an anonymous function?

I have inherited this snippet of jQuery JavaScript and am currently brushing up on my jQuery. NetBeans IDE complains that ...