a JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

learn more… | top users | synonyms

0
votes
2answers
86 views

Increment a text field value

So let's take this code which increments a Javascript text field value: ...
3
votes
5answers
35 views

Handing focusing and unfocusing of multiple form fields

Here is a link to my problem ...
1
vote
1answer
25 views

UI-slider widget

This represents a UI-slider widget - there are a number of different widgets on the page. This function is repeated per widget - 90% of the code is the same - the only difference being that each has a ...
1
vote
1answer
46 views

Add a class to an element when it's loaded

I want to add a class to only those <p> elements that have an <img>. So far this is what I have, it works, but I ...
0
votes
0answers
31 views

Sticky navigation using jQuery waypoints

I have built a one-page website with a sticky navigation using jQuery waypoints. Now I just added a highlight function for the menu buttons for when the user scrolls to that certain area. However, I ...
4
votes
1answer
67 views

Custom marquee consumes a lot of CPU power

I've a code which applies marquee to certain elements by using the requestAnimFrame method. However, when I test my application on a lower spec PC (Intel Celeron ...
-3
votes
0answers
25 views

Spot the error(s) in this script [on hold]

I'm working on a little text based javascript game and I've been using chromes Javascript console for the output. The 'game' works off a series of methods written into an object called ...
1
vote
1answer
33 views

More maintainable API for wysihtml5 widget

For an HTML calendar with jQuery, I put in event listeners to enable jQuery drag-and-drop that reads and writes to persistence using HTTP get and post with JSON structures. Now I'd like to make the ...
2
votes
1answer
18 views

Making empty cells in Underscore template

From the back-end, I am receiving 8 data. The client requires showing that the row per data is 7, so I have 1 data in balance. I have created empty data and made the empty cells, which works fine. But ...
3
votes
2answers
46 views

Adding markers to a Google Maps map from a source

I decided to make a simple project to learn the Google Maps API. I'd appreciate a review of the code below. I'd like to know what I did right and wrong. The code pulls data from one source and adds ...
4
votes
1answer
64 views

Flood game implementation

There is the implementation of flood game on my GitHub. The app.coffee is the main part of project: ...
0
votes
1answer
36 views

jQuery hide and show option value from a dropdown

I have form with an "add field" button that does an Ajax call to add a new field. Each field contains a list of options to choose from. When is public is Yes, I ...
0
votes
0answers
32 views

Switching pages with css3 and jQuery

I am trying to implement a custom page switcher. In this fiddle I succeeded in doing what I want. Do you think it can be done in a better way, above all performance wise? For example, on iPad (first ...
0
votes
0answers
15 views

App using JQueryMobile and Cordova

I have received a project that is built on Cordova with JQueryMobile. The app is already published on three platforms and is being used by 100K+ users. Now I have to add new functionality in it. But ...
5
votes
2answers
82 views

Reducing code for animation of expanding menus

I wonder if I can reduce the code to optimize it better? ...
3
votes
1answer
53 views

Database of Pokemon

I've just started to write jQuery and have just written my first code using ajax calls. I'm fetching data from the pokeapi and am using it to random generate new pokemon. I have refactored it as ...
2
votes
0answers
63 views

Loading screen animation

I am trying to make a loading screen but my code isn't DRY. How could I make it DRY? I have thought about using CSS3 keyframes but I might have problems cross-platform. ...
2
votes
1answer
82 views

Toggle-item inside a Bootstrap dropdown-menu

I have this working code for a toggle-item inside a Bootstrap dropdown-menu. See demo here. I suspect that it should be possible to improve it : in order to have a shorter code and avoid all the ...
3
votes
1answer
34 views

Dynamic “filtering” list using jquery

I'm building a list of filters for a website user to filter on, such as a product category page. I'm giving the user the option to filter on brandname, model name, or gender. To avoid serverside code ...
6
votes
2answers
98 views

Check image dimensions, calculate aspect ratio, set image dimensions, resize

I have created a set of functions to calculate the aspect ratio of an image, set a height/width on document.ready and on ...
4
votes
1answer
47 views

Checkbox multiselect user interface

I wrote a small multiple select interface in jQuery, and I'm looking for any feedback on code quality/usability. It has to do the following: When check all is checked, all boxes must become checked ...
2
votes
1answer
48 views

Merging nested tables into a single table

I made a function that merges nested tables into a single table. The following function converts the headers. It takes an old table that has nested tables in its rows, takes all the headers of these ...
3
votes
1answer
35 views

Changing a video link when hovered

I have three divs that change a video link when they are hovered. I have the code working in three different blocks but I am not sure how to combine them since it is very repetitive. ...
0
votes
0answers
29 views

Keeping variables in scope with JS Module Pattern and Jasmine

I am looking for some pointers/feedback on how to write better modules and simple tests. This is a simple module which displays (unfortunately an infame for now — yes I know it's bad) the user's cart ...
2
votes
0answers
71 views

Simulate the way that php receive the form

Lets say I have this form ...
2
votes
1answer
174 views

Call html() on two jQuery selector objects

In my webpage I have two places where I need my JavaScript to write dates. How to do it in one go? Selectors: ...
5
votes
1answer
47 views

Clearing and Loading Data on HTML Form Fields

What I'm trying to do: I have a single bootstrap modal which contains a form that I'm using to ADD records and at the same time UPDATE. What I have: A two buttons to SHOW this modal that calls a ...
0
votes
2answers
17 views

Adding cells to a table

I'm calling the below 2 function once per Cell in a table with over 135 columns and over 200 rows (that is 134*200 = 26800 times, I'm not running the functions on ...
4
votes
2answers
128 views

Get <TH> texts into a tab separated string

table_with_headers = $(this.dom.table).find("thead tr th").map(-> $(this).text() ).get().join("\t") Can one write it nicer? I especially dont like the inner ...
4
votes
1answer
37 views

Select the one table before my link

I need to select the <table> before the table where the link I clicked. I can't use IDs, because I don't want to edit my jQuery every time I add a new table. ...
1
vote
2answers
95 views

Loading div sections from separate files

I am loading divs from separate HTML files into a div on the index.html page. This is being done using jQuery's ...
42
votes
3answers
1k views

Celebratory fireworks animation

To celebrate an important event, I hastily cobbled together an HTML canvas-based animation. A few concerns I have include: Performance: Does it run reasonably smoothly on most modern machines? How ...
5
votes
1answer
224 views

Shortening jQuery array

In short, the code picks up to 9 different ids from li in jailplayer. If a hillside, it ...
2
votes
1answer
46 views

Underscore template conditional can be reduced

I have 11 data items and would like to print them as a group. Each group will have header and at the end of the group I need to print continue label. For that, I ...
2
votes
1answer
57 views

jQuery and CSS3 slideshow

I have built a slideshow using jQuery and CSS3. jQuery is used to trigger class changes (.slide1, .slide2 ...) on the slide container (...
1
vote
1answer
45 views

Populate dropdown B on selection in dropdown A

On selection from drop-down A (HTML select) I need to populate another "sub"-dropdown with a different list of values. For instance, on selection of country in ...
2
votes
1answer
74 views

Multiple jQuery hidden element toggles

I have a handful of images working as jQuery toggle switches - Showing or hiding an element on a click event. The code below mostly works as intended, but I'm fairly certain I'm using a lot of ...
4
votes
2answers
72 views

Multiple uses of $window.scroll

I'm using $window.scroll twice in a jQuery script for different uses. Should I try and combine them? ...
1
vote
1answer
74 views

Show image when in viewpoint of browser window

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
vote
1answer
52 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
55 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
77 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
54 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
28 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
29 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
45 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
34 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
68 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
97 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
94 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 ...