background preloader

JavaScript & JQuery

Facebook Twitter


Excellent Jcrop manual. Jcrop Home • Download • Manual • Examples This document provides a roadmap for Jcrop implementation.

excellent Jcrop manual

Introduction Jcrop is a powerful image cropping engine for jQuery. It's been designed so developers can easily integrate an advanced image cropping functionality directly into any web-based application without sacrificing power and flexibility (or the weeks of coding, testing and debugging). Jcrop also features clean, well-organized code that works well across most modern web browsers. Lots of jQuery select boxes. Gets or sets the selection.

lots of jQuery select boxes

If the value parameter is not specified, the id attribute of the currently selected element is returned. If the value parameter is specified it will become the current selection. val method invoked on a single-select with an unset value will return "", while a val method invoked on an empty multi-select will return []. Example: alert("Selected value is: "+$("#e8").select2("val")); $("#e8").select2("val", "CA"); Notice that in order to use this method you must define the initSelection function in the options so Select2 knows how to transform the id of the object you pass in val() to the full object it needs to render selection.

Gets or sets the selection. Data method invoked on a single-select with an unset value will return null, while a data method invoked on an empty multi-select will return []. Reverts changes to DOM done by Select2. Opens the dropdown. Closes the dropdown. Notifies Select2 that a drag and drop sorting operation has started. jQuery/Ajax upload w/o refreshing page. Are you looking for ajax file/image upload and preview without refreshing page using Jquery.

jQuery/Ajax upload w/o refreshing page

I had implemented this ajax form submitting using jquery.form plugin and used Arun Shekar's image cropping PHP code for uploading images. Just five lines of JavaScript code, Using this you can upload files, image and videos. Download Script Live Demo. Custom thumbnail for embedded video.


Multiple file upload. What this is This jQuery Multiple File Upload Plugin ($.MultiFile) is a non-obstrusive plugin for jQuery that helps users easily select multiple files for upload quickly and easily on your server whilst also providing some basic validation functionality to help developers idenfity simple errors, without having to submit the form (ie.: upload files).

multiple file upload

What this isn't This plugin will not create a dialog that allows the user to select multiple files at once. That simply cannot be done via javascript. If that's what you need, you should consider using HTML5's multiple="multiple" attribute or one of the many other flash based file upload solutions (eg.: SWFupload, uploadify and others) How it works The plugin creates a new file input element every time the user select a file, which allows the user to select a file, then another, then another, then another and so on... selecting as many files is required, one at a time.

“Password” hint instead of ******** - works in IE. Advertisement As you know, the user login box of the website contains the following fields username and password. Furthermore, most of them put the “Username” inside user name field and “********” inside password field to save the space within designing.In this post I’ll show you how to show “Password” text in the password field. It doesn’t actually does so but this tips will make it looks like so.

Now, forget about the user name field. Let’s talk about password field. You can view the demo by clicking here. Now let’s look at the code to do this, here is the Html code for this, As you can see above, I’ve to place the two input field inside two separate divs. LavaLamp. Hover above and feel for yourself, the nifty effect of Lava Lamp. What you just experienced is nothing but the LavaLamp menu packaged as a plugin for the amazing jQuery javascript library. I personally believe that the effect rivals that of flash – Don’t you? Especially considering the fact that it is extremely light weight. Just so you know, it weighs just 700 bytes(minified)! Often I have noticed, that the credits are usually granted towards the end. As User Interface developers, we know that one of the first widgets our visitors use is a “Menu”.

I hope you agree that a typical HTML widget consists of 3 distinct components. A semantically correct HTML markupA CSS to skin the markupAn unobstrusive javascript that gives it a purpose Now lets follow the above steps and implement the LavaLamp menu for your site. Why you should let Google host jQuery. All too often, I find code similar to this when inspecting the source for public websites that use jQuery: If you’re doing this on a public facing website, you are doing it wrong.

why you should let Google host jQuery

Instead, I urge you to use the Google HostedLibraries content delivery network to serve jQuery to your users directly from Google’s network of datacenters. Doing so has several advantages over hosting jQuery on your server(s): decreased latency, increased parallelism, and better caching. In this post, I will expand upon those three benefits of Google’s CDN and show you a couple examples of how you can make use of the service. Notebook page flip. Everyday jQuery is getting more and more popular because of it’s usefulness, flexibility and speed.

notebook page flip

Masked Input Plugin. First, include the jQuery and masked input javascript files.

Masked Input Plugin

Next, call the mask function for those items you wish to have masked. Optionally, if you are not satisfied with the underscore ('_') character as a placeholder, you may pass an optional argument to the maskedinput method. Optionally, if you would like to execute a function once the mask has been completed, you can specify that function as an optional argument to the maskedinput method. You can now supply your own mask definitions. jQuery(function($){ $.mask.definitions['~']='[+-]'; $("#eyescript").mask("~9.99 ~9.99 999");}); You can have part of your mask be optional.