Tagged Questions
19
votes
1answer
392 views
Random clothes generator
UPDATED, original code can be found here.
Also, my main goal is to not only improve the style of my coding, but also to improve the logic in finding random combinations. As of now it seems way too ...
18
votes
2answers
3k views
Writing a better alternative to jQuery Autocomplete
Over the last months I have been writing a jQuery plugin called Better Autocomplete (Code on Github). It originated from another project, a Drupal module called Linkit, but I decided it should be a ...
17
votes
1answer
244 views
Managing network address information
I'm a developer at a networking company that really has no peers that work above me that I can use for any sort of sounding board for my code, so basically it is me. I was wondering if anyone would ...
15
votes
8answers
2k views
Set of jQuery .onclick functions
I am hiding and fading in different content on the same page using jQuery to hide() and fadeIn() the content depending on which ...
13
votes
5answers
799 views
Looking for a cleaner way to write a jQuery function
I've got a piece of code that takes an element, checks where it is, and if it's beyond a set place in the viewport, make the opacity increase to 1. I've made the code so that it only runs the checks ...
13
votes
3answers
161 views
Simplifying a repetitive event handler
Is there a more efficient way of writing this? It seems like so much redundancy that this can be greatly reduced. Basically the only difference is if isNodeWebkit ...
12
votes
3answers
4k views
Coffeescript beautification and refactoring
As much as I try, I cannot seem to get this Coffeescript code to look beautiful (I'd like to think it is possible). I have tried both Javascript and Coffeescript. Just to be clear, this code works ...
11
votes
3answers
541 views
Animated JavaScript/jQuery game
This was a code test I was asked to complete by employer, and since they rejected me, I wonder what should I have done differently.
...
11
votes
3answers
607 views
How good/bad is this feed manager?
I am sorry for the indentation style and lack of comments. But apart from that, how good/bad is the code snippet?
What it does is:
Reads from a RSS feed using Google feed API
shows the list in an ...
11
votes
3answers
596 views
Is this code good enough? (jQuery)
I'm working on a simple star rating system, and before I move on to actually "tallying" the votes, which I figure I'll just do with $.ajax, I wanted to make sure ...
11
votes
2answers
250 views
HTML5 / JavaScript Tic-Tac-Toe
As an exercise, I decided to create a simple Tic-Tac-Toe game. It is Ruby on Rails based, but as for now I'm not using the server side for anything (I intend to build up on it in the future, though).
...
10
votes
3answers
872 views
Ultimate Tic-Tac-Toe Challenge
This is my attempt at the Ultimate Tic-Tac-Toe code challenge.
It uses jQuery to build out the game grid and find the states of all the "buttons" (actually ...
10
votes
1answer
610 views
Optimizing and consolidating a big jQuery function
I understand this is a very vague question and a lot of code to look over. My question is basically: I have all these functions that work together to create functionality on a page: is the structure ...
10
votes
3answers
551 views
How to do efficient string concatenations in JS?
I form DOM nodes as strings and append them to DOM tree like below using jquery.
...
10
votes
3answers
211 views
MS Excel type of grid in jQuery
I have created a MS Excel type of grid in jQuery. I want to learn best practices and I need your comments for more optimized code.
Please review the code and offer your suggestions.
Demo
jQuery:
...
10
votes
3answers
754 views
Clickable icon for expanding/collapsing content
The general idea of the code is that I have a + or - icon (".trigger") that is click-able ...
10
votes
2answers
1k views
Handling click events on ingredients list
I'm learning programming and would appreciate any feedback on my code. I've come up with the below code. The logic works fine but the code itself seems rather confusing to me. Are there some patterns ...
10
votes
4answers
896 views
Any tips on making this JS better?
Working on a personal project to keep different snippets/examples/small projects of mine organized. I want to make the most of my page width, so I decided to write a navigation menu that slides out. ...
10
votes
2answers
589 views
Trying to learn idiomatic JavaScript and jQuery
I have been doing server-side development for a couple of years, but I am just now getting into doing some client-side programming. As a JavaScript exercise, I created a dead-simple jQuery image ...
10
votes
1answer
136 views
Tabbed navigation to hide and show pages
I'm new to jQuery and trying to learn how to refactor my bloated code to make it nicer and better maintainable.
I have a tabbed navigation which I'm using jQuery to hide and show pages depending on ...
9
votes
2answers
1k views
9
votes
2answers
97 views
Member list reveals member information on click (#1)
What I'm doing?
I'm creating a member-list where initially only the names are visible. Clicking the names reveals the member information. This is done with jQuery by adding/removing classes.
I left ...
9
votes
2answers
164 views
Assigning width and height to specify image dimension using jQuery
After testing my site against GTMetrix, I get warnings on not specifying image dimensions. I am working on a WordPress site. Here is my solution:
My first solution was:
...
9
votes
2answers
1k views
Display progress bar to show async. request status using JQuery
Instead of using ProgressBar plugin, I've below script to display the progress bar for async. requests on the page. Could anyone provide any feedback on this esp. if there will be any issues like ...
9
votes
1answer
179 views
9
votes
2answers
126 views
Can this secure, random generator be improved?
This random generator uses cryptographically secure numbers/chars instead of Math.random(). The Javascript code with jQuery works well but I affect clean code ;) It ...
9
votes
1answer
128 views
Responsive Foundation Orbit Image Gallery
I decided to refactor the code for a responsive image gallery, that I setup not too long ago. Following the suggestions @joseph-the-dreamer made, and some other best practices, I cut down on the ...
8
votes
4answers
1k views
How to optimize this code in jQuery?
I have the following code to get the ID of a <a href="#ID"> </ a> and go to their respective div ...
8
votes
2answers
439 views
Optimize this jQuery tab controller further
How do I optimize this code further? Goal is to edit "js-tab" in one place. This is what I tried to follow.
Full code here.
...
8
votes
3answers
750 views
Improve random password generator
Can you please take a look at my code and improve it (if necessary)?
http://jsfiddle.net/U6R6E/
Javascript (with jQuery)
...
8
votes
3answers
102 views
Fail-proof AJAX
I'm working on a page using AJAX that will get an entire .php page when the navigation button is clicked. I have that set up and working right. But this is my first time using AJAX, so I'm not sure ...
8
votes
3answers
382 views
Calculate karma based on retweets
This script is meant to look for an id in the data attribute in each containment div, then send an Ajax call to get the amount of retweets, calculate the karma based on those retweets and then display ...
8
votes
2answers
140 views
Namespacing jQuery/jQueryUi into markup that I don't control
I have a project that I've been trying to get just right for the past three months and it's still not quite there yet.
I'm injecting some jQuery and jQueryUi code into pages that I have no control ...
8
votes
1answer
149 views
Please review my Nonogram game
I am writing a Nonogram game in JavaScript.
I would like to know your opinions on the code and suggestions on how to improve it.
I'm using a MVC approach.
the Model has two matrices (represented ...
8
votes
1answer
2k views
Looking for improvements on my jQuery-UI tagging widget
I am looking for any possible improvements on this tagging widget.
I ask for special attention to be paid to my blur handler in the event of a autocomplete option being specified but any ...
7
votes
7answers
781 views
DRY-ing jQuery code for portfolio site
I'm currently working on my portfolio site and it's all great, but I'm unsure how to DRY my jQuery. I'm repeating myself a lot in the jQuery and it's just messy.
HTML:
...
7
votes
3answers
706 views
What do you think about my questionnaire?
This time I'm not here to ask for help with my code, but to ask you to judge my code. Where can I improve? What should I do better? Where did I do things wrong?
This is a quiz that I had to do as ...
7
votes
4answers
542 views
Repeated function structure
How can I refactor this code? I know it's repetitive but I'm not sure how to fix it.
...
7
votes
1answer
208 views
First HTML5 game. - Snake!
so here's my first HTML5 game. It's a really simple snake. I've never made a game before and haven't had too much experience with JavaScript.
Html
...
7
votes
2answers
159 views
Cleanup code to add div structure to element
I was cleaning up my code when I came across this situation :
...
7
votes
2answers
128 views
Can this code be cleaned? Multiple objects triggering different hover events
When the user visits the web page and hovers over an album artwork, the title of the piece and the artist name appears. It leaves when the mouse leaves.
I have achieved this with the following code:
...
7
votes
1answer
193 views
First jQuery Plugin - SmoothSlider
I've been working with jQuery, mostly consuming plugins and using bits and pieces here and there for other functionality. Anyways, I wrote some standalone functionality in jQuery for a project and ...
7
votes
1answer
85 views
DRY multiple if statements used to show/hide elements based on slider value
I'm showing and hiding 4 svg paths based on the value of a slider, all is working as expected, but it still feels a little cumbersome. Does anyone know a way to "DRY" it out a little more?
jsFiddle
...
7
votes
1answer
143 views
First “Revealing Module” implementation
I have a little js I call a "jqGrid Factory" to encapsulate common settings and functionality across my web app.
I just want to see what improvements I can make.
...
7
votes
2answers
151 views
jQuery-animated navigation menu
On the attached fiddle is what I hope will the be future UI for navigation on my own personal portfolio site. I was hoping you guys could critique the JavaScript I wrote to accomplish the most ...
7
votes
1answer
146 views
MV* Pattern for a board game
I have made a small game in Javascript, while simultaneously learn about the ever so popular model view controller. The game is this, there are 3 players(green, purple, yellow) and they have to try ...
7
votes
1answer
1k views
jQuery plugin which will print to a printer an element or a jQueryUI Dialog
I have a need to print the content of a jQueryUI Dialog to a printer, and I couldn't find anything to my liking. I developed the following simple jQuery plugin which prints one or more provided HTML ...
7
votes
1answer
9k views
JQuery UI Datepicker with beforeShowDay function
I am relatively new to JavaScript and JQuery. I wanted a Datepicker that has the following functionality:
Weekends are not selectable
Non working days (bank holidays etc.) are not selectable
The ...
7
votes
1answer
181 views
A better looking 'treeview' - dealing with lots of checkboxes
I'm working on the ui for an application which uses a custom ui control that is loosly related to a treeview.
This treeview has two levels:
Top level which has a number of different geographical ...
6
votes
4answers
6k views
null/undefined checking for checking seats
This looks pretty messy (need to reduce nesting I feel). I need a check an input for a seat, but I can't guarantee it has a value (one may not be chosen for example). If the seats aren't in a certain ...