a JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.
0
votes
0answers
23 views
Detect image in viewpoint of browser window then show image
I am working on a web project and am trying to create a way to detect when an image is in viewpoint of the browser window then load/show the image. Since there are some rather large image that are ...
-1
votes
0answers
18 views
Pass more than one value in event parameter on jQuery On method [on hold]
I´m doing a code to make <p:rowEditor> in Primefaces have a hint.
I did it
...
1
vote
1answer
45 views
Auto-populating user info from database
Auto populate user info from database when user inputs employee number. The same applies when the user inputs name/extension/mobile/email/
Some code is duplicated. Is there any way to make it ...
4
votes
1answer
45 views
Animating a div element
I would like to see how would you write this code for best practices, it will help me to learn from you.
This is my jQuery code I use on scroll event to addClass and animate div element.
...
1
vote
1answer
40 views
jQuery Widget - Progress Tracker
This is a follow up on JS Progress Bar Widget
I've rewritten it as a jQuery Widget Factory widget, attempting to follow that standard as much possible and fixing the various problems pointed out in ...
4
votes
1answer
44 views
Character and word count functionality
I have this JS that has a lot of redundant functionality, and it works but looks unseemly.
I would love some assistance with making this more DRY (Don't Repeat Yourself):
...
2
votes
1answer
27 views
Adding a class to an element in a plugin
I have the following code, and I just added a Class to the element that uses the plugin. I works perfectly, but I am wondering if there is a better way to do it.
...
1
vote
1answer
25 views
jQuery animations with only one callback
I'm aware of doing that 'magic' inside $.when(). How should I achieve same effect writing code more readable ? I read something about a $.Defferer() that I think should help but I don't know how to ...
1
vote
1answer
31 views
JavaScript / jQuery stopwatch
Just as a learning exercise, I set out making a stopwatch without looking up how to do it etc.
I know it will have been done many times before. I'm just looking for some feedback on what I should do ...
4
votes
0answers
21 views
Dragable infinite loop carousel, performance issues on dragging large number (25+) of slides
I have two instances of this carousel to test with, one with 7 slides and the other with 25. They run the exact same code. The 7 slide instance drags smoothly forever as intended, but the 25 slide ...
5
votes
1answer
47 views
JS Progress Bar Widget
Demo of the widget: http://jsfiddle.net/slicedtoad/Lywvbsf4/
It's a progress bar that shows a list of steps and which one is being completed as well as allowing previous steps to be revisited.
It ...
1
vote
1answer
88 views
Reduce CPU usage in mouse-scrolling script
I'm working on a jQuery plugin. The problem is that when I use it I can see a high CPU usage in task manager.
I think the problem is here:
...
7
votes
2answers
76 views
JavaScript Validation
Bit of a preface on my motive: I'm self taught and have never really worked in a collaborative environment. My only benchmark for quality is "does it work" and I've never been really subject to peer ...
3
votes
2answers
52 views
Performance of a method to mask all but one rectangular element on the page
The point of this code is to mask a page where the user is editing the page's 'body' content. This is in a CMS. The rest of the page is the website template (i.e. header, index bar etc...). I've ...
1
vote
2answers
15 views
Enable and disabled multiple inputs
I have to enable/disable multiple inputs when a select change. It works but I want to do it better. How can I improve my code?
...
3
votes
2answers
59 views
Swap images on click with specified image
I am new to jQuery and needed a solution for the following problem:
There are 3 images in a row and when the user clicks on one of them all three pictures are hiding and instead another image shows ...
1
vote
0answers
28 views
Is it long polling or short polling?
I wrote the following script and php code for long-polling architecture by googling references, I would like to know if this is long-polling or short-polling, ...because I am not sure:
bc_test.js
...
15
votes
1answer
187 views
Javascript Minesweeper (with Stack Snippets!)
As Stack Snippets are live on Code Review now, I wanted to do something quick in it as part of rolfl's challenge on meta. And when you make things quick, they probably get dirty. And when things get ...
2
votes
0answers
29 views
Editing <option> values through a textbox with jquery
I've written a script that will allow me to enter a serial number for each received product, in-line in a table. First you enter the amount received, which increases the size of the ...
3
votes
1answer
51 views
jQuery menu: hide and show on click
I am new to jQuery and currently practicing. I wrote a little piece of code to show and hide a navigation on click and change the text of the button when the navigation is opened and closed.
I am ...
6
votes
1answer
128 views
Thumbnails for bootstrap carousel jQuery plugin
Codepen: http://codepen.io/srkimir/pen/mGbrf
Github: https://github.com/srkimir/thumbnails-carousel
While you slide left or right appropriately, thumbnails gets selected and change their opacity to ...
3
votes
1answer
46 views
1
vote
1answer
42 views
Checking form input for an AJAX request
I've made a few functions to check form input for an AJAX request. I am still getting used to JavaScript and some of these AJAX requests. I am looking for any suggestions to better work with ...
3
votes
1answer
34 views
Responsive menu highlights page with JavaScript
This is a responsive navigation menu (pure css), that highlights the page with a short JavaScript I found online. I have it all working, but the CSS is totally a mess. The menu is actually a PHP ...
2
votes
2answers
63 views
Using jQuery and AJAX process a form with PHP
I'm looking to collect form input and pass it to a file called processing.php with AJAX
JS:
...
6
votes
3answers
148 views
Efficient if-statements and how to use variables
The first part of the code (above the in-code comment in the middle) looks messy.
I know I could use variables to make it cleaner, I just don't exactly know yet how can I effectively apply those when ...
5
votes
1answer
100 views
Transforming jQuery form code into clean code
The following JS code handles when the form is submitted and some little extra stuff.
I'd like to have it reviewed on the following aspects:
Readability
Efficiency
Usability
OOP
It works exactly ...
3
votes
1answer
46 views
Solving the Shortest Path problem (little bit of TSP, too)
Some background info:
I'm working at a shipping company and the company's web developer has been fired a week ago. My boss knew that I had some knowledge in web development, so until we get a new ...
13
votes
2answers
1k views
Is this form submission validator professional?
I have written some jQuery code for AJAX form submission:
...
2
votes
1answer
35 views
Creating a slider to adjust the width and two click events
I have some JavaScript that was put together for functionality but I wanted to know if there was a better way to write it. As it stands it's a little hard to read and follow.
...
6
votes
1answer
156 views
Gmail Mouse Gesture
Gmail had this awesome feature and it was discontinued for some reason. Nowadays I have installed a nice Google Chrome plugin for this job.
A couple of months ago I had to develop a similar feature ...
2
votes
1answer
34 views
Non-restrictive email validation
Just looking to do some super-duper basic email validation and was wondering if my code is efficient.
IE8 compatibility is a requirement.
...
6
votes
2answers
162 views
2
votes
1answer
30 views
Spree Billing/Shipping Address Checkbox
I used JS to re-populate the shipping address into the billing address when a checkbox is clicked. I'm wondering whether there is a more concise/better way to write the code below:
...
3
votes
1answer
43 views
jQuery cycle content of static HTML page
I am making a simple jQuery code that changes the content of a static HTML page when a button (previous/next aka left/right) are pressed. The page is static, so the content that must be cycled (images ...
3
votes
2answers
83 views
Better paradigms for posting JSON from a table?
With a table based interface where users can update the rows by pressing a button. Perhaps there is a better way of doing this, without pressing a button, i.e. post on textarea/row change (could be a ...
3
votes
0answers
47 views
Simple slideshow with jQuery
I've made a very simple slideshow that works by appending and prepending images (on click and every 3 seconds). This is my first time trying to use classes or objects so any help would be great. I ...
6
votes
1answer
65 views
Simple JavaScript Backbone.Js tool to highlight multiple search terms
I wrote a simple JavaScript tool to highlight multiple keywords at the same time in some text. It uses different color for each keyword, and also shows the count of matches.
I'm using Backbone.js ...
2
votes
1answer
38 views
Clicking child view and preventing parent view from running dblclick event
I have a parent view which has a dblclick event handler bound to it. I also have a view which is a descendant of the parent. This child view has a click event handler bound to it.
Currently, my code ...
5
votes
1answer
36 views
Animated magazine
How can I write this code better? I'm doing an animated magazine, so I run and then clean the animation per page.
...
1
vote
1answer
45 views
4
votes
0answers
68 views
JavaScript/jQuery Image Slider
I've just wrote this class for an image slider (it cross-fades rather than sliding, so a class rename may be beneficial). It's my first proper attempt at JavaScript OOP. Can anyone see any real issues ...
2
votes
1answer
72 views
Filter on HTML table using jQuery
I am adding some check box filters on a HTML table, based on whether a check box is checked or not, and I am toggling rows. Is there anyway I could improve this code? There is no issue with it at ...
2
votes
2answers
97 views
Is there any disadvantage of using MVC Razor Syntax codes inside a NoScript tag?
I'm creating a ASP.NET MVC Website that display blogs from the database by AJAX.
The problem is - I have limit the results to only 10 by default and add a Load More button to display 10 more results ...
20
votes
8answers
5k views
Better way to code these deeply nested / multiple if/else statements
I have coded this mess of JavaScript and a bit of jQuery. Everything here works perfect as intended, however it is a real mess. What would be the best way to clean this up with best practices and ...
0
votes
3answers
16 views
Improve jQuery performance - should window.location.href be variable?
We have search results on our website and want to display different banners based on the search term entered. My solution for this is to check the URL for the search term since it is stored there, and ...
7
votes
1answer
105 views
Incrementing letter-spacing of one line of text
I was asked to create a script which will increment the letter-spacing of one line of text, until its width matches that of the first line; for use in headline/subheadline text to maintain a block ...
2
votes
1answer
59 views
Google Map, SVG Graph and ruler
I would like to get feedback on the code. It is working and can be seen here.
I welcome any kind of feedback, since I am just starting to use JavaScript. Epecially in the case of performance, there ...
2
votes
0answers
44 views
Detail view, edit field: create input, buttons
I have a detail view for my object. There is only one field available for editing. When I click on the Edit button I want to hide text for field and show input with the OK and Cancel button.
...
5
votes
1answer
203 views
Manipulate HTML document loaded into WebBrowser control
I have developed my custom solution for this. It happened that the first solution is using XPath queries and the second, a conceptually similar to the first one, is using CSS queries processed by ...