Skip to content
Advertisement

Call functions from function inside an object (object literal)

I’m learning to use object literals in JS, and I’m trying to get a function inside an object to run by calling it through another function in the same object. Why isn’t the function “run” running when calling it from the function “init”? Answer That code is only a declaration. You need to actually call the function: Demo: http://jsfiddle.net/mattball/s6MJ5/

Deactivating and activating an E-mail form

I’m trying to get the code below to keep an E-mail form deactivated until 6 seconds after the page is fully loaded. What can I do to make it work like that? Answer It is not a good idea to hard code the duration. Instead you should call the activate using asynchronous call. Anyways, here is the working code.

Remove a value from an array in CoffeeScript

I have an array: How could I check if “World” is in the array? Then remove it if it exists? And have a reference to “World”? Sometimes maybe I wanna match a word with a regexp and in that case I won’t know the exact string so I need to have a reference to the matched String. But in this

JavaScript test if a CSS stylesheet is applied with CSS3 media query

I have two style sheets: The second one should only be loaded when the window is 800px or wider (narrower displays get a layout more appropriate for mobile devices). The JavaScript needs to know if that second style sheet is being applied, I have tried the jQuery: But when you get around the 790 – 810px width, Chrome/Firefox (and probably

Fadeout all nested divs

On my page I’m trying to do smth like that: Lets say, when we click on some link with id min_reg it animates div with idftr_form_cntr, and shows another div tcr_form_cntr within. There are 3-4 links that does same function but shows another div within ftr_form_cntr. Well if user clicked one of this links for the first time then there

Create Instagram-esque filters with javascript?

Can I create Instagram-esque filters with javascript? The images can be processed client-side or server-side(node.js) I could overlay some pngs and box-shadows with css to get a limited amount of similar effects, but I was wondering if there was anything out there that can truly process images like this in js. Thanks! Answer I ended up finding this, http://vintagejs.com/

How to extract url data from Reddit API using JSON

I’m trying to extract the image post URLs from a subreddit feed, and render <img> elements on my page. Been trying to hack together the .getJSON() Flickr example from the jQuery Docs for a while now and I’m not getting anywhere. Code in question: In the body, I have the element: div#images I understand that I need to use JSONP,

JavaScript Regex to match a URL in a field of text

How can I setup my regex to test to see if a URL is contained in a block of text in javascript. I cant quite figure out the pattern to use to accomplish this EDIT: So the Pattern I have now works in regex testers for what I need it to do but chrome throws an error for the following

Advertisement