반응형
반응형

The Holy Grail jQuery Plugin of CSS Design

 

http://www.codeproject.com/Articles/629019/The-Holy-Grail-jQuery-Plugin-of-CSS-Design

 

 

 

The joy of creating jQuery Plugin resides in the fact that you can wrap a big deal of jQuery code that otherwise could end up spread all over your codebase, and by establishing a jQuery Plugin, you can confine a coherent set of functionalities in a self-contained component, and then work on this component in order to make it useful for a very wide community of web developers.

In Holy Grail plogin code, we start by creating a immediately-invoked function expression (IIFE) in JavaScript code. The IIFE is a design pattern that provides the self-containment of private functions variables and functions within the plugin scope, thus avoiding the pollution of JavaScript's Global Environment. JavaScript developers will easily recognize the IIFE pattern by the following code:

 

            (function(){
              /* code */ 
            }());
        

In the above code, the outermost pair of parentheses wrap the function in an expression and immediately forces its evaluation. The pair of parentheses in the last line of code invokes the function immediately.

Notice that, within the jQuery plugin development, it's important to pass the jQuery reference as a parameter in our IIFE expression, so that the dollar sign ($) can be used safely within the scope of the plugin, without the risk of external libraries overriding the dollar sign:

 

            (function($){
              /* Our Holy Grail jQuery Plugin code goes here. Notice the $ sign will never have a meaning other than the jQuery object. */ 
            }(jQuery));
        

Next, we create the function that will hold and execute the whole of our Holy Grail plugin functionality. Notice the options parameter, which will contain all the initialization settings needed to configure the bar chart according to the Holy Grail plugin requirements:

 

            (function($){
              $.fn.holygrail = function (options) {
                    //as expected, our holy grail plugin code falls here.
                }
            }(jQuery));
        

Inside the plugin function, the context is given by the this JavaScript keyword. Most often than not, developers will be tempted to reference the context by enclosing it using the dollar sign (i.e. jQuery) function: "$(this)", instead of just this. This is a common mistake, since the this keyword already refers to the jQuery object and not the DOM element inside which the bar chart is being created:

 

            (function($){
              $.fn.barChart = function (options) {
                    var self = this;
                }
            }(jQuery));
        

In the above JavaScript code, we are storing the value of the this object in the self reference. This is needed specifically inside functions, where the this keyword behaves as the context for the function itself, instead of the context for the outermost plugin function. Thus, the self will be used as the context for the bar chart plugin instead.

The plugin code starts by defining a series of settings that will become the default values for the most common configurations. This will provide our plugin users with convenient standard values that can be either configured (allowing a flexible charting component) or ignored (so that the plugin user can provide the smallest set of startup configuration).

As the plugin component gets more sophisticated, it's generally a good idea to provide a more complete and comprehensive set of default settings, in order to give users a powerful, flexible and unobtrusive plugin.

 

            $.fn.holygrail = function (options) {

                var self = this;

                // Create some defaults, extending them with any options that were provided
                var settings = $.extend({
                    headerContent: options.headerContent,
                    centerContent: options.centerContent,
                    leftContent: options.leftContent,
                    rightContent: options.rightContent,
                    footerContent: options.footerContent
                }, options);

        

The above code snippet shows the plugin settings: there is a different plugin configuration for each of the page's sections: headerContent, centerContent, leftContent, rightContent and footerContent:

 

		=========================
		|         header        |
		=========================
		|      |        |       |
		| left | center | right |
		|      |        |       |
		=========================
		|         footer        |
		=========================
		

The plugin code itself is all about gathering the content elements and rearranging them in a way that the resulting rendering complies with the above layout:

 

			/// <reference path="jquery-1.9.1.min.js">
			(function ($) {

				var HolyGrail = {};

				var raster;

				$.fn.holygrail = function (options) {

					var self = this;

					// Create some defaults, extending them with any options that were provided
					var settings = $.extend({
						headerContent: options.headerContent,
						centerContent: options.centerContent,
						leftContent: options.leftContent,
						rightContent: options.rightContent,
						footerContent: options.footerContent
					}, options);

					var body = $('body');
					var hgHeader = $('<div>').attr({ id: 'hg-header' });
					var hgContainer = $('<div>').attr({ id: 'hg-container' });
					var hgCenter = $('<div>').attr({ id: 'hg-center', 'class': 'hg-column' });
					var hgLeft = $('<div>').attr({ id: 'hg-left', 'class': 'hg-column' });
					var hgRight = $('<div>').attr({ id: 'hg-right', 'class': 'hg-column' });
					var hgFooter = $('<div>').attr({ id: 'hg-footer' });

					$(hgContainer).append(hgCenter);
					$(hgContainer).append(hgLeft);
					$(hgContainer).append(hgRight);
					$(body).append(hgHeader);
					$(body).append(hgContainer);
					$(body).append(hgFooter);

					$(this.headerContent).attr({ 'class': 'hg-pad' });
					$(this.centerContent).attr({ 'class': 'hg-pad' });
					$(this.leftContent).attr({ 'class': 'hg-pad' });
					$(this.rightContent).attr({ 'class': 'hg-pad' });
					$(this.footerContent).attr({ 'class': 'hg-pad' });

					$(hgHeader).append($(settings.headerContent));
					$(hgCenter).append($(settings.centerContent));
					$(hgLeft).append($(settings.leftContent));
					$(hgRight).append($(settings.rightContent));
					$(hgFooter).append($(settings.footerContent));
				}
			}(jQuery));
		</div></div></div></div></div></div></reference>

반응형
반응형

Guideline.js — Create non-invasive tours

guideline.js

반응형
반응형

Minified.js — A much smaller JS library

minified

반응형
반응형

SkelJS — Build responsive sites and apps

skeljs

 

반응형
반응형
17 jQuery Carousel Plugins

 

http://www.designerledger.com/jquery-carousel-plugins/

 

Do you own a picture or video based website? Well, in case your picture or video is not very interesting, people might not even look at your site. This could be a problem. With content you could work on the fonts or probably on the look of the page. Content has a variety of ways to make it look attractive and creative. But, it is difficult to make your website filled with videos and pictures look beautiful. So, is there no way out? Well, it’s difficult not impossible. You could probably use the jQuery carousel plugins that would help create a whole new world of video and picture for you.

With jQuery carousel plugins you can animate your website in order to make it look interesting. The effects created with this plugin give your video a special effect. In fact your videos are handled in a brilliant way such that they appear to be interesting. What happens when you use these plugins? Well, your video suddenly appears inside a small circle that gives away an interesting and appealing look to the overall website. You can have your logos on a rectangular slider that has an option of navigation. What could be better than this for your pictures? You could even create small circles surrounding your main rectangle and make it appear in a sequential format. Wow! This sounds really appealing to the eyes. How about creating small images below the main image? This could make your picture look interesting and effective to the eyes. A small portion of the other images can attract your eyeballs completely.

So, you can actually use one or all of these plugins and create an interesting plugin mix. Try out these interesting plugins and give your website filled with videos and photos an amazing feel.

If you like this article, you might be interested in other article on best jQuery Plugins to Create Dynamic Layouts. and Parallax Scrolling Tutorials and jQuery Plugins for Designers.

jSprouts

jsprouts

Sprouts is a creative slider with gorgeous and innovative animations. Thumbnails are shown on mouseover surrounding the slider. jSprout can handle also custom HTML contents, videos, flash and even Google Maps, very useful for mini-sites, vCard sites, personal sites or portfolio sites.

Demo

BubbleSlider

bubble-slider

BubbleSlider is a jQuery circle only slider. It is really light (3kb for minified version and 8kb for commented version) and provides different eye-catching effects.

Demo

jQuery Responsive Grid Quote

jQuery-Responsive-Grid-Quote

A jQuery plugin help you to display team information or customer testimonial. This carousel plugin is responsive and lightweight. Main features include auto delay slideshow, optional auto scroll, optional thumbnail background color, font size etc.

Demo

jSliderPro

jSliderPro

jSliderPro is a complete and highly customizable banner rotation and is equipped with a complex set of features that make it extremely flexible and adaptable. With little effort you can create unique, fully responsive – and compatible with all major browsers. HTML5 slideshows for your websites.

Demo

Dasky Timeline Slider

dasky-timeline-slider

Dasky is a jQuery timeline slider,you can use it to show you products’s chagelog/loadmark, or loadmark of you team/life. And others what you want. It based on the power of css transforms and will fallback in old browsers who do not support it.

Demo

J.B.Slider – Standalone

J.B.Slider-Standalone

J.B.Slider is easy to use jQuery image slider with description box and button link for further reading. This requires jQuery and jQuery UI (both included in the package) Supports Internet Explorer 7 to 9, Chrome, Firefox, Safari, Opera.

Demo

Versatile Touch Slider

Versatile-Touch-Slider

Versatile Touch Slider is a jQuery plugin that offers a variety of options. It may just be a banner rotator or a shelf to display products. Has the touch feature to mobile and drag for the desktop. The navigation can also be done via buttons and menu. Through the lightbox it is possible show multimedia content (video, audio, image and html content). See below the main features and click on Live Preview to see some examples.

Demo

ajSlideshow

ajSlideshow

AjQuery gallery slideshow plugin is a perfect slideshow and it is as it looks. With sleek, smooth and simple 5 transition effects this plugin is compatible with all modern browsers

Demo

Everslider

Everslider

Everslider is fully responsive, mobile optimized jQuery carousel plugin. It uses CSS3 transitions for animations with fallback to jQuery. Supports unlimited slides with any content. Everslider recognizes touchswipe, mousewheel and keyboard interactions and works in vast range of browsers starting with IE7 up to mobile browsers.

Demo

Ultimate Smart Slider

Ultimate-Smart-Slider

Stop coding your images! This is a jQuery plugin that automatically generates a slider from a folder of images, taking the name of the images as captions. You can change the order of the images, and also select which ones will show the caption.

Demo

RoyalSlider

RoyalSlider

RoyalSlider is easy to use jQuery image gallery and content slider plugin with animated captions, responsive layout and touch support for mobile devices. As navigation you can use thumbnails, tabs or bullets. Use it as image slider, slideshow, HTML content slider, gallery, banner rotator, video gallery, carousel or even presentation. Developed in best practices of HTML5, CSS3 transitions are used for all animations (with fallback).

Demo

All Around

All-Around

All Around content slider is a multi-purpose all-in-one slider solution for your website. It supports both images and video. It can be an easy and effective solution for your shop related website as you can display your products in an interesting and eye appealing way. All Around carousel is perfect for almost all type of websites and it can fit perfectly into all business areas.

Demo

Cloud Carousel

Cloud-Carousel

This jQuery carousel features optional auto-reflections, and the information contained in the Alt and Title tags of the images can optionally be displayed as you hover over each image. There are some benefits to doing this kind of thing in JavaScript rather than Flash, not least of which is the ease of integration, small file size, SEO, and inherent degradability/ accessibility. Not having another dev-tool in the workflow is another plus. The carousel features realistic perspective. Many 3d carousels only apply perspective scaling to the size of the images, not their positions. This results in disproportionate gaps appearing between items as they shrink in the distance which looks odd.

Demo

bxSlider

bxSlider

This is a fully responsive jQuery content slider plugin. Slides can contain images, video, or HTML content. This plugin has advanced touch / swipe support built-in and uses CSS transitions for slide animation (native hardware acceleration!)

Demo

jCover Flip

jCover-Flip

jCoverflip is a jQuery widget that allows website administrators to present featured website content in a visually appealing manner. The widget is quick setup and is highly configurable, and can run as a Drupal Module or standalone. jCoverflip enables quick, easy and granular customization to the look and feel and feature set.

Demo

AGILE Carousel

AGILE-Carousel

Implement your slideshow with the Agile Carousel JQuery plugin. Highly customizable so you can build according to your requirements. JSON data format is used to provide easier integration with external data or data from your CMS. Use it for agile web development.

Demo

Rotating Image Slider

Rotating-Image-Slider

This is a tutorial where you will create an asymmetrical image slider with a little twist: when sliding the pictures you will slightly rotate them and delay the sliding of each element. The unusual shape of the slider is created by some elements placement and the use of thick borders

Demo

반응형
반응형

Promin — Break your forms into bite-sized pieces

promin

 

반응형

+ Recent posts