background preloader

Select2 3.0

Select2 3.0

ddSlick - a jQuery plugin for custom drop down with images With traditional drop downs i.e. using <select><option></option></select> you are limited to only text and value. But with this easily configurable jquery plugin, you can now create a custom drop down that can very well include images, a short description, along with your usual text and value. Take a look at the following demos in action. 1Basic Drop down using JSON Source: When using JSON to populate, the plugin requires the specific data format. 2Render from HTML select options //Make it slick! Use HTML5 data attributes data-imagesrc and data-description with your regular HTML select elements to add images and description. 3GET Selected Dropdown Option You may use jquery .data() with your selector to get data from plugin. selectedIndex (0 based), selectedItem (HTML 'li' element), selectedData (nested object with text, value, description, imageSrc) 4SET selected Dropdown Option Try an index between 0 to 4 5Callback Function on Dropdown Selection 6Dropdown with default selection

Preloading Images with jQuery and JavaScript Creating effects on websites using jQuery and other JavaScript has really grown from flashy extras to full on applications in the browser. Part of slick applications is images. They might be part of the content being loaded or something like an icon in an application. A jQuery Script Here is a simple jQuery script to preload the images. (function($) { var cache = []; // Arguments are image paths relative to the current page. $.preLoadImages = function() { var args_len = arguments.length; for (var i = args_len; i--;) { var cacheImage = document.createElement('img'); cacheImage.src = arguments[i]; cache.push(cacheImage); } }})(jQuery) You'll notice that this isn't anything special to jQuery. To use the preloading make a call like: jQuery.preLoadImages("image1.gif", "/path/to/image2.png"); Breaking Down The Script Let's break down this snippet of code to see what's happening. (function($) { ... })(jQuery) We are wrapping the code in an anonymous function and passing jQuery in with a $ alias.

jQuery Masonry HTML9 Responsive Boilerstrap JS Galleria – The JavaScript Image Gallery highlight.js

Related: