I am looking for help / a point in the right direction / or a solution for a flicker/jump, when scrolling on a looping/infinite website, which can be seen in this fiddle. What seems to be causing the jump is: “$(window).scrollTop(half_way – child_height);”, and what could also be a Chrome wi…
Tag: jquery
Detecting Browser History Actions
I am building a Html 5 website using push state and I wondering whether its possible in javascript or JQuery to detect whether the browser’s back button has been pushed. I would like to include it in an if statement like so: Answer You’re looking for the popstate event. An example: Or with the eve…
Styling a voting system
I have made a sample voting system here: Sample Voting System However after repeated attempts I couldn’t get it to style the way I want because the developer has used way too many divs here. Either the font becomes too big or gets overlapped with the number or goes out of proportion, etc. I want it to l…
Add a space on top of a #page HTML link
When I have a link that loads a section within the same page, the link will make the section clicked on load at the top of the browser window, I need to somehow add a space/gap of like 100px on top of all these sections that are linked like this. Any ideas on how to do this? Answer In your
jQuery AddClass then removing a class
In my Rails application, I send an Ajax request when the user hits the Save button, when it sends the request, I can return some jQuery. What I’d like to do is add a class (saving), have a delay and then remove the class. So, I added this: For some reason, it isn’t working. What am I doing wrong? …
JavaScript insertAfter and insertBefore
I am playing around with the JavaScript functions insertAfter and insertBefore, however I am trying to insertAfter and insertBefore two elements. For instance, consider the following HTML: Then I have this JavaScript code snippet: Basically when the Up class is called, the previous row is moved up and when th…
Js or jquery file.type.match for jpg and png only
How can I limit the mimetype for only png and jpg using file.type.match below is my code Answer from your question it sounds like you don’t want to do something like: You can make an array of acceptable extensions and loop through them like: See this fiddle for a test.
Drop Event Not Preventing Default
I’ve the following: http://jsfiddle.net/KywJT/ I’m using Chrome version 24.0.1312.52 m and last jQuery (1.8.3). When I drop a file into the box, browser is not preventing default beaviour. Can you please help me? P.S. dragexit is deprecated correct? Answer This should fix the issue for you.
How do I add text to specific div element using jQuery?
I am having a problem with jquery. My HTML is Now I am trying to add text in span using Jquery. After that it becomes, But, I am tryting to achieve is, How can I do that in jquery? Answer Several possible alternatives Others have provided their answers already but let me give you some more alternatives. The s…
Inject Javascript code into a web page
I’d like to download web page as html file. Before I save the web page source code in html file, I’d like to edit some of the page content first. I assume I can edit the content using Javascript. Unfortunately I have little experience with Javascript. I guess I have to inject my script into the we…