반응형
반응형

How To Remove Unnecessary Modules in jQuery

http://www.hongkiat.com/blog/jquery-remove-modules/

 

OS X 에서 jquery 설치시 불필요한 모듈 제외하고 설치하기.

 

jQuery is undoubtedly the most popular JavaScript library, (almost) every website on this planet is using it. This affects jQuery to include all the functionalities within the library to cover every instance and possibility.

However, when we work on a simple website, we might only use a few of the functions. Thus, it would be more efficient if we were able to run only that necessary function and not everything other unused function as well. As of version 1.8, jQuery allows us to do this. We are able to exclude some jQuery modules that are not necessary in your project. So, let’s see how we can do it.

First thing first

First, we need to install some tools required to do the job. These tools are Git, Grunt, and Node.js. If you running on OS X, the easiest way to install all these tools is through an OS X Package Manager called Homebrew.

Install Homebrew

So, let’s open up your Terminal and run the following command to install Homebrew. As said, Homebrew will let us install the other mentioned tools more easily.

  1. ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Install Git

After the Homebrew installation completed, run the following command to install Git.

  1. brew install git

Install Node.js

Run the following line to install Node.js

  1. brew install node

Install Grunt

Lastly, we need to install Grunt. Run this command.

  1. npm install -g grunt-cli

Build jQuery

Currently, jQuery allows the following modules to be excluded.

Modules Command Description
Ajax -ajax This specifies the jQuery AJAX API that includes jQuery.ajax(). jQuery.get(), and .load() function
CSS -css This specifies the functions from jQuery CSS Category that includes .addClass(), .css(), and .hasClass().
Deprecated -deprecated This specifies the deprecated modules or functions.
Event Alias -event-alias This specifies the event functions like .click(), .focus(), and .hover().
Dimensions -dimensions This specifies the functions to set CSS dimension. Such functions include .height(), .innerHeight(), and .innerWidth().
Effects -effects This specifes the functions that set animation effects, such as .slideToggle(), .animate() and .fadeIn()
Offset -offset This specifies the functions that retrieve45 coordinates and position. Such funtions include .offset() and .position().

Before we are able to customize the jQuery, we need to clone it from the Github repo by running this command in the Terminal.

  1. git clone git://github.com/jquery/jquery.git

You should then find a new folder named jquery created under your user folder. Navigate to that directory using this command.

  1. cd jquery

Next, we need to install Node dependencies modules to run our project.

  1. npm install

We then build our jQuery by simply running Grunt command (and hit enter)

  1. grunt

It will return the following report, if the operation succeeds.

And as we can see from the report, our jQuery is saved within the dist/ folder. Our jQuery is, at this point, set with all the functionalities, thus the size is quite large, 239kb. The minified version is at 83kb.

Removing Modules

Let’s say, we want to remove the Effect modules from jQuery; we can run this command.

  1. grunt custom:-effects

If we take a look back at the file size, it is now decreased to 220 kb.

To exclude multiple modules, separate each module with a comma, for example:

  1. grunt custom:-effects,-ajax,-deprecated

Final Thought

jQuery can help us manipulate DOM easily, but with 200 kb more at the size, it could affect your website performance. So, by eliminating some unnecessary jQuery modules, your jQuery script will certainly run faster and more efficient. We hope that this little tip would be useful for your next project.

반응형
반응형
Javascript library 추가하기  - APTANA

 

link : https://wiki.appcelerator.org/display/tis/JavaScript+Library+Support

 

JavaScript Library Support

메타 데이터의 끝으로 건너뛰기
메타 데이터의 시작으로 이동
Chapters

Libraries

Studio ships with the ability for users to extend support for JavaScript libraries in content assist. Below is a list of libraries and content assist files we've located that should be compatible with Studio. This is not a complete list, and compatibility is not guaranteed, but if you see something on this list and it doesn't work, please let us know.

Dojo (http://dojotoolkit.org)

The XML files Dojo ships require a little bit of massaging to be readable by the Studio content assist processor.

Drop the SDOCML file anywhere into your Web Project (feel free to put it in a special folder).

Alternately, to update docs to a newer version (should one come out)

ExtJS/Sencha (http://extjs.com)

Drop the SDOCML file anywhere into your Web Project (feel free to put it in a special folder).

Google

Drop the VSDoc files into your Web Project.

jQuery (http://jquery.org)

Install the jQuery ruble and reference it:

  1. Commands > Install Bundle > jQuery
  2. Right click on a project, select Properties > Project Build Path and select the checkbox for jQuery 1.6.2.

If you already have the jQuery bundle:

  1. Choose Commands > Bundle Development > Update User Bundles

or

  1. Find the Aptana Rubles folder on your system
  2. Delete the Ruble
  3. Restart Studio
  4. Install the Ruble again as above

OpenLayers (http://openlayers.org/)

There is a current bug with adding the single http://www.openlayers.org/api/OpenLayers.js file to a project to get content assist. As a workaround:

Note that this technique will not actually show documentation on the classes. For that, we need a SDOCML file which could be created from the source Natural Docs.

YUI (http://developer.yahoo.com/yui/)

Drop the SDOCML file into your Web Project.

반응형
반응형

21 Amazing jQuery Pagination Plugins

http://inspiretrends.com/jquery-pagination-plugins/

Easy Paginate jQuery Plugin for Pagination

Demo || Download

With pagination controls you are able to glance through easily and simply through the items found on the list. This plugin allows easy implementation which are very useful and important to use it in you projects. It main function is to check large number items on the list quickly.

jQueryPaginationPlugins-16

jPages: jQuery Pagination Plugins

Demo || Download

jPages is a client-side pagination plugin but it gives you a lot more features comparing to most of the other plugins for this purpose, such as auto page turn, key and scroll browse, showing items with delay, completely customizable navigation panel and also integration with Animate.css and Lazy Load.

jQueryPaginationPlugins-17

jQuery Simple Content Sorting Plus Plugin

Demo || Download ]

jQueryPaginationPlugins-18

This plugin creates a simple content sorter for your content and allows you to control your content with pagination!

WordPress Smart Pagination Plugin

Demo || Download ]

Smart Pagination WordPress Plugin includes custom pagination to your website in just a couple of mintes

jQueryPaginationPlugins-19

Beautiful Data: jQuery Pagination Plugins

Demo || Download ]

Beautiful Data is a great way to turn a boring HTML table into something that supports features like paging and sorting. This jQuery plugin can also access data from CSV and JSON just by specifying the source file.

jQueryPaginationPlugins-20

jPList

Demo || Download ]

jPList is a flexible jQuery plugin for sorting, pagination and filtering of any HTML structure (DIVs, UL/LI, tables, etc)

jQueryPaginationPlugins-21

AJAX Pagination using jQuery and PHP with Animation

Demo || Download

This is one of the best plugins that is easy to use and users and developers do not have to refresh the sites every now and then. It mostly uses animation and is becoming one of the popular website functions.

jQueryPaginationPlugins-1

Easy pagination with jQuery and Ajax

Demo || Download

It maintains your data only in a fixed size and allowing you to navigate easily backwards and forward. The information can now be easily digest into smaller pieces.it reduces the load on the server and the page reloading.

jQueryPaginationPlugins-2

Extreme Makeover: jPaginator CSS3Edition

Demo || Download

This tutorial is mainly designed for the beginners and takes very few minutes to be completed. It contains a lot of pages links that can be navigated along first so that you can be able to select them. Your experience in the websites are really improved by the slider for animating links.

jQueryPaginationPlugins-3

jQuery Quick Pagination

Demo || Download

It enables the user to generate quick long list and page contents into numbered format. It is important part of the website as it allows designers and other developers to neatly separate their websites content very easily and efficiently tom access pagination without messing up with things.

jQueryPaginationPlugins-4

jQpagination

Demo || Download

This is a jQuery plugin for quickly creating a JavaScript which control pagination interface and functionality. The plugin present is controlled with a special class and attributes of HTML elements. It is pretty simple and unique and yet functional.

jQueryPaginationPlugins-5

jQuery Pagination Plugin

Demo || Download

They enable you to display more than one page with the present navigational elements in order to move from one page to the next. When there are large list to search for results or articles it is able to display them in grouped amount of different pages.

jQueryPaginationPlugins-6

jQuery Pagination Revised

Demo || Download

This plugins contains a wide variety of features which are used for effective working of the website. The long list in a huge page can be separated into multiple pages. The site layout is improved with the database and other properties with full control to adapt to the style properly.

jQueryPaginationPlugins-7

jPaginate-jQueryPagination System Plugin

Demo || Download

The new version comes with instant HTML pagination which has the speed and property to allow you separate a series of elements. The splitting of series put elements into organized pages which give it more appealing appearance.

jQueryPaginationPlugins-8

jQuery Pagination Plugin: Smart Paginator

Demo || Download

jQuery Pagination plugin makes the task very easy and simple for different navigation logic that is already incorporated for customization purposes. On the client side it filter the data of the user automatically due to presence of Smart Pagination jQuery and it allows addition of Pagination.

jQueryPaginationPlugins-9

jPaginate: A Fancy jQuery Pagination Plugin

Demo || Download

You can be able to glide through the different pages by hitting over the arrows. The pagination plugin with sensibility to apply animation on page numbers for efficacy. It also provides many short links on one side to the pages on the other end.

jQueryPaginationPlugins-10

Pajinate-A jQuery Pagination Plugin

Demo || Download

It is among one of the flexible and simple plugin that comes with different tools to separate long lists into different various break up pages. The point between paginated page loads is very minimal and it is the simpler app to serve as side implementations.

jQueryPaginationPlugins-11

Pagination with jQuery, MySQL and PHP

Demo || Download

This is a flexible jQuery plugin which comes in a manner to show you how implement Pagination. It is contain in the JavaScript which comes with PHP jQuery and MySQL. The script contained is very easy and simple to use.

jQueryPaginationPlugins-12

Sweet Pages: A jQuery Pagination Solution

Demo || Download

It allows you to convert and change unordered file of different items into a search engine optimization friendly which are put to navigate pages. The user uses it to comment on their treads or other type of configured contents.

jQueryPaginationPlugins-13

Simple Pagination

Demo || Download

The jQuery plugin enables easy and simple pagination. They simplify the different kinds of tasks, they also come with 3CSS themes which are simple to use and allows customization of your website. It get most of its support from Bootstrap.

jQueryPaginationPlugins-14

jPaginator

Demo || Download

It fun to use it as it comes with a slider which you can ask for an unlimited number of pages to be open. It contains unique elements which you can use. It also comes with CSS page which enable easily customization of the website.

jQueryPaginationPlugins-15

 
반응형
반응형
Best jQuery Chart Libraries for Building Interactive Charts

 

http://codegeekz.com/best-jquery-chart-libraries-for-building-interactive-charts/

1. Chart.js : Charting Library with HTML5 Canvas

chartjs
Chart.js is an impressive JavaScript charting library that is built on top of HTML5 canvas. It currently supports 6 chart types (line, bar, radar, pie, column and polar area) and all this comes in a standalone, less than 5kb package. Colors, fonts, borders and their sizes can all be customized. Also, optionally, charts can be loaded with an animation.

Source

2. xCharts : For Building Data-Driven Charts

xcharts
xCharts is a JavaScript library for building beautiful and custom data-driven chart visualizations for the web using D3.js. Using HTML, CSS, and SVG, xCharts are designed to be dynamic, fluid, and open to integrations and customization.

Since xCharts use SVG, we are able to accomplish most of our styling of xCharts directly through CSS. This means you have quite a bit of control to handle the visualization however you want. The best way to style charts is to start with the included stylesheet, or use your browser’s element inspector to see each elements CSS class selectors that are available to use.

Source

3. Sigma.js : Draw Graphs Using HTML5 Canvas Element

sigma-js
Sigma.js is a free and open-source JavaScript library to draw graphs, using the HTML5 canvas element. It has been especially designed to share interactive network maps on a Web page or to explore dynamically a network database. It is distributed under the MIT License.

Source

4. HighCharts

highchartjs
Highcharts is a charting library written in pure HTML5/JavaScript, offering intuitive, interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.

Source

5. Fusion Charts

fusion-charts
The FusionCharts jQuery plugin helps you add interactive JavaScript charts and graphs to your web, mobile and enterprise applications. It combines the delight and comprehensiveness of FusionCharts Suite XT with the easy-to-use jQuery syntax.

Source

6. Flot : Attractive JavaScript Plotting for jQuery

flot
Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks and interactive features. Some key features of plot is turning series on/off, zooming, interacting with the data points and it integrates a simple tooltip feature.

Source

7. JS Charts : Free JavaScript Charts

jscharts
JS Charts is a JavaScript based chart generator that requires little or no coding. With JS Charts drawing charts is a simple and easy task, since you only have to use client-side scripting (i.e. performed by your web browser). No additional plugins or server modules are required. Just include our scripts, prepare your chart data in XML, JSON or JavaScript Array and your chart is ready!

Source

8. jQuery Sparklines

jQuery-Sparklines
This jQuery plugin generates sparklines (small inline charts) directly in the browser using data supplied either inline in the HTML, or via javascript. The plugin is compatible with most modern browsers and has been tested with Firefox 2+, Safari 3+, Opera 9, Google Chrome and Internet Explorer 6, 7, 8 & 9 as well as iOS and Android.

Source

9. Morris.js : Draw Time-Series Line Graphs

morrisjs
Morris.js is a lightweight library that uses jQuery and Raphaël to make drawing time-series graphs easy. Morris.js started life as the code that powered the graphs on howmanyleft.co.uk. Now it’s been open-sourced for the whole world to extend and enjoy.

Source

10. jQuery OrgChart

jquery-org-chart
jQuery OrgChart is a plugin that allows you to render structures with nested elements in a easy-to-read tree structure. To build the tree all you need is to make a single line call to the plugin and supply the HTML element Id for a nested unordered list element that is representative of the data you’d like to display.

Source

11. jgPlot

jqPlot
jqPlot is a plotting and charting plugin for the jQuery Javascript framework. jqPlot produces beautiful line, bar and pie charts with many features like rotated axis text, automatic trend line computation, tooltips and data point highlighting, sensible defaults for ease of use and many more.

Source

12. Grafico

grafico
Grafico is a javascript charting library built with Raphaël and Prototype.js. The library provides a wide array of graphs and stays with the guidelines laid out by Stephen Few and Edward Tufte. Grafico provides pretty charts that effectively communicate their information.

Source

13. GraphUp

graphup
GraphUp is a very flexible and lightweight jQuery (v1.4+) plugin to spice up your data tables. It visualizes the values using color, bar charts and bubbles.

Source

14. dygraphs

dygraphs-javascript
dygraphs is an open source JavaScript library that produces produces interactive, zoomable charts of time series. It is designed to display dense data sets and enable users to explore and interpret them. You can mouse over to highlight individual values. Click and drag to zoom. Double-click to zoom back out. Change the number and hit enter to adjust the averaging period.

Source

15. jsPlumb jQuery Plugin

jsplumb
jsPlumb jQuery plugin provides a means for a developer to visually connect elements on their web page, in much the same way you might have seen on Yahoo Pipes. jsPlumb allows you to connect elements on the screen with “plumbing”, using a Canvas element when supported, and Google’s Explorer Canvas script to support older browsers. Full transparent support for jQuery dragging is included, the API is super simple, and the compressed version of the script is just 10.5K.

Source

 

 

Best jQuery Chart Libraries for Building Interactive Charts Code Geekz.mht

 

반응형
반응형

http://www.catswhocode.com/blog/useful-jquery-code-snippets

 

Smooth scrolling to #anchor

On your site footer, it is very useful to provide a quick way for your visitors to scroll back to the top of the page. Here is a simple way to smooth scroll to a #anchor of your choice.

 

// HTML:
// <h1 id="anchor">Lorem Ipsum</h1>
// <p><a href="#anchor" class="topLink">Back to Top</a></p>


$(document).ready(function() {

	$("a.topLink").click(function() {
		$("html, body").animate({
			scrollTop: $($(this).attr("href")).offset().top + "px"
		}, {
			duration: 500,
			easing: "swing"
		});
		return false;
	});

});

Source: http://snipplr.com/view/26739/jquery–smooth-scroll-to-anchor/

Image resizing using jQuery

Although you should resize your images on server side (using PHP and GD for example) it can be useful to be able to resize images using jQuery. Here’s a handy code snippet to do it.

$(window).bind("load", function() {
	// IMAGE RESIZE
	$('#product_cat_list img').each(function() {
		var maxWidth = 120;
		var maxHeight = 120;
		var ratio = 0;
		var width = $(this).width();
		var height = $(this).height();
	
		if(width > maxWidth){
			ratio = maxWidth / width;
			$(this).css("width", maxWidth);
			$(this).css("height", height * ratio);
			height = height * ratio;
		}
		var width = $(this).width();
		var height = $(this).height();
		if(height > maxHeight){
			ratio = maxHeight / height;
			$(this).css("height", maxHeight);
			$(this).css("width", width * ratio);
			width = width * ratio;
		}
	});
	//$("#contentpage img").show();
	// IMAGE RESIZE
});

Source: http://snipplr.com/view/62552/mage-resize/

Load content on scroll automatically

Some websites such as Twitter loads content on scroll. Which means that all content is dynamically loaded on a single page as long as you scroll down.

Here’s how you can replicate this effect on your website:

var loading = false;
$(window).scroll(function(){
	if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
		if(loading == false){
			loading = true;
			$('#loadingbar').css("display","block");
			$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
				$('body').append(loaded);
				$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
				$('#loadingbar').css("display","none");
				loading = false;
			});
		}
	}
});

$(document).ready(function() {
	$('#loaded_max').val(50);
});

Source: http://fatfolderdesign.com/173/content-load-on-scroll-with-jquery

Test Password Strength

When building forms, it’s a very good practice to provide verifications on the front-end first so the visitor do not have to submit the form endlessly to correct problems. This code snippet is using regular expressions to test if a password is strong enough. Of course, don’t forget to validate your forms on the server side as well!

$('#pass').keyup(function(e) {
     var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$", "g");
     var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
     var enoughRegex = new RegExp("(?=.{6,}).*", "g");
     if (false == enoughRegex.test($(this).val())) {
             $('#passstrength').html('More Characters');
     } else if (strongRegex.test($(this).val())) {
             $('#passstrength').className = 'ok';
             $('#passstrength').html('Strong!');
     } else if (mediumRegex.test($(this).val())) {
             $('#passstrength').className = 'alert';
             $('#passstrength').html('Medium!');
     } else {
             $('#passstrength').className = 'error';
             $('#passstrength').html('Weak!');
     }
     return true;
});

Source: http://css-tricks.com/snippets/jquery/password-strength/

Equalize heights of div elements

Equalizing heights of div elements is not possible (or very hacky) to do in pure CSS, so jQuery is here to help. The code below will automatically adjust the heights of div elements according to the higher one.

var maxHeight = 0;

$("div").each(function(){
   if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});

$("div").height(maxHeight);

Source: http://css-tricks.com/snippets/jquery/equalize-heights-of-divs/

Simple and efficient png fix for IE6

In 2013, IE6 is finally almost gone and people are using newer browsers. But still, in some situations you have to care about this horrible browser and provide a IE6-compliant website. As IE6 can’t deal with png transparency, here’s a super simple jQuery hack to force png rendering.

Just add a .pngfix class to anything you want fixed or put in some other jQuery selector.

$('.pngfix').each( function() {
   $(this).attr('writing-mode', 'tb-rl');
   $(this).css('background-image', 'none');
   $(this).css( 'filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="path/to/image.png",sizingMethod="scale")');
});

Source: http://itknowledgeexchange.techtarget.com/itanswers/

Parsing json with jQuery

Parsing json data with jQuery is not complicated at all. Here is an efficient example on how to parse json data and append it to your web page.

function parseJson(){
	//Start by calling the json object, I will be using a 
        //file from my own site for the tutorial 
	//Then we declare a callback function to process the data
	$.getJSON('hcj.json',getPosts);
 
	//The process function, I am going to get the title, 
        //url and excerpt for 5 latest posts
	function getPosts(data){
 
		//Start a for loop with a limit of 5 
		for(var i = 0; i < 5; i++){
			//Build a template string of 
                        //the post title, url and excerpt
			var strPost = '<h2>' 
				      + data.posts[i].title
				      + '</h2>'
				      + '<p>'
				      + data.posts[i].excerpt
				      + '</p>'
				      + '<a href="'
				      + data.posts[i].url
				      + '" title="Read '
				      + data.posts[i].title
				      + '">Read ></a>';
 
			//Append the body with the string
			$('body').append(strPost);
 
		}
	}
 
}
 
//Fire off the function in your document ready
$(document).ready(function(){
	parseJson();				   
});

Source: http://hankchizljaw.co.uk/tutorials/parse-json-with-jquery-snippet/06/05/2012/

Alternating Row Colors

On big lists or tables, alternating row colors can drastically improve readability. Here’s how to alternate row colors on a list of elements using some jQuery. You can use any HTML element you like, td, tr, li, etc…

//jquery
  $('div:odd').css("background-color", "#F4F4F8");
  $('div:even').css("background-color", "#EFF1F1");


//html example
<div>Row 1</div>
<div>Row 2</div>
<div>Row 3</div>
<div>Row 4</div>

Facebook like image preloader

Ever noticed how fast images load when paging through a Facebook photo album? This is because Facebook is preloading each of these images into your browser’s cache before you even view them. Here’s how you can achieve a similar behavior on your website using some jQuery magic.

var nextimage = "/images/some-image.jpg";
$(document).ready(function(){
window.setTimeout(function(){
var img = $("<img>").attr("src", nextimage).load(function(){
//all done
});
}, 100);
});

Source: http://www.nealgrosskopf.com/tech/thread.php?pid=77

Make entire div clickable

Here’s an easy way to make the parent div of a link clickable. Let’s say you have this html code:

<div class="myBox">
     blah blah blah.
    <a href="http://google.com">link</a>
</div>

The following lines of jQuery will make the entire div clickable:

$(".myBox").click(function(){
     window.location=$(this).find("a").attr("href"); 
     return false;
});

Source: http://css-tricks.com/snippets/jquery/make-entire-div-clickable/

반응형
반응형

jQuery 및 전자정부 표준 프레임워크가 업데이트 되었습니다.

jQuery 1.10.1 and 2.0.2 released
- http://cafe.naver.com/buldon/6930

jQuery 2.0 릴리즈에 대해
- http://cafe.naver.com/buldon/6737

전자정부 표즌 프레임워크 2.6 출시
- http://cafe.naver.com/buldon/6929

반응형

+ Recent posts