Skip to content

Tag: javascript

Bind Ready Function and Resize Event

In jQuery, is it possible to somehow “bind” an action to both the ready function and a resize event? I’m trying to add/remove classes on resize and I want the initial class state to be there on ready. Answer The easiest way to do this is to trigger the resize event immediately after binding …

Blur image with JavaScript or jQuery?

Is there any way to blur images with JavaScript/jQuery so that when they are blured I can sharpen them by hovering them with the mouse? Answer Pixastic can do that for you. Here’s the relevant doc: http://www.pixastic.com/lib/docs/actions/blur/ To blur: To revert: The entire solution with jQuery:

Open Gmail on mailto: action

How to force web-browser to navigate to Gmail and create (if logged in) new letter with filled in field ‘To’ on click on mailto:SomeMail@blabla.example? Answer There’s a Greasemonkey script. The compose URL is: https://mail.google.com/mail/?view=cm&fs=1&to=email@domain.example

How do I create bit array in Javascript?

What is the best way of implementing a bit array in JavaScript? Answer Here’s one I whipped up: UPDATE – something about this class had been bothering me all day – it wasn’t size based – creating a BitArray with N slots/bits was a two step operation – instantiate, resize. U…

Changing the order of the Object keys….

This is a sample object which i am getting from back end, now i want to change the order of the object. I don’t want to sort by name or size… i just want to manually change the order… Answer if you want to manually reorder. simply create new object and assign values using old object.

Sending Javascript Object to PHP via Ajax

I’m learning Ajax by failure and have hit a wall: I have an array (if it matters, the array is storing number id’s based on what checkboxes the user checks) that is written in Javascript. I have a function that is called when the user clicks the ‘save’ button. The function is as follow…

javascript focus() not working on Firefox and IE?

I’m trying to appear a form and focus it, for some reason it only works on Chrome. How can I make it work across browsers? You can see it not working in here: http://jsfiddle.net/CCxrp/1/ What can I do to make it work? Thanks Answer You just need to swap the order of things: The divs have to be in the