jQuery-jKit
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:A very easy to use, cross platform, jQuery based UI toolkit, that's still small in size, has the features you need, and doesn't get in your way of doing things!
jQuery-jKit
===========

A very easy to use, cross platform, jQuery based UI toolkit, that's still small in size, has the features you need, and doesn't get in your way of doing things!

Full Documentation
------------------

Get the full documentation over here: [jquery-jkit.com](http://jquery-jkit.com/)

Basics
------

###Including the library

    
    
    
    
    
###Basic Usage (HTML)

jKit uses the the "data-jkit" attribute to inject it's functionality into your html. If you don't want, you don't have to use JavaScript, at all!

    data-jkit="[slideshow:interval=4000;speed=250;animation=fade]"
    
Let's have a closer look at what's inside the attribute:

    data-jkit="[command:option=value;anotheroption=anothervalue][anothercommand]"
    
The first thing is always the jKit command that you want to execute. In the first example we used the slideshow command. If you don't want to use your own command options, than that's all you have to do. If you want to use your own options, than add a doublepoint followed by your options like this:

    data-jkit="[command:option1=value1;option2=value2;option3=value3]"
    
In most cases you add just one command to a HTML element, but sometimes you want to add more, and that's exactly why we have the brackets! Here's an example with two commands:

    data-jkit="[split:container=span][cycle:what=css.color;where=span;sequence=,,,#f30]"
    
Here's a complete example with the random command. Inside a div element we have four paragraphs and want to only show three of them, randomly chosen:

    

Text 1

Text 2

Text 3

Text 4

And to illustrate two commands on one single element, we create a slideshow from those three randomly selected paragraphs:

Text 1

Text 2

Text 3

Text 4

It's that easy! You can even have jKit stuff inside jKit stuff as in the following example where we put lorem ipsum text into the paragraphs:

If you want you can put spaces and even linebreaks between the options to make it more readable, for example like this:

In one of our tests, we put a slideshow into a tab navigation, into an accordion, into another accordion and a last accordion. It worked great! In our first versions of jKit, we abused the rel attribute to execute the commands, you can still do that, but we think you should better use the HTML 5 doctype together with the data-jkit attribute. Anyway, if you really want to use the rel attribute, here's how:

###Basic Usage (JavaScript) You can execute all jKit commands with JavaScript, too. This is not the prefered way, but sometimes you have to do it and this is how: $('#someElement').jKit('yourCommand', { 'option1': value1, 'option2': 'value2' }); ADVANCED -------- There's a lot of cool stuff under the hood of jKit for advanced users. Here's how to get most out of jKit. ###Macros Macros can make your life a lot easier if you need to use the same command and options more than once. There are two ways to define a macro, the first one is on plugin init: You can than use them like this:
...
The second way to define a macro is with the macro command: [macro:name=hoverhide] It creates a macro from the previously used command on the same element. Here's a real example to get a better idea of how the macro command works:

When using a macro, it is possible to overwrite any of the options defined in the macro. Here's an example:

One last warning! If you name a macro the same as a built in command, you will overwrite that command, so please be carefull and give your macros unique names! ###Easing Plugin All commands that use animations have an option called "easing". To get all the great easing options, you have to include this amazing easing plugin on your page (or some other easing plugin that may be around somewhere). ###Dynamic Option Values jKit makes it possible to use dynamic option values by adding the "*" character to the end of the value. You can either use global variables or global functions. Here's an example where we limit the length of a string to the number stored in a global variable. 1234567890123456789012345678901234567890123456789 Here's how you would do the same thing using a global function: The second way is of course only usefull in case you don't want to return the same value each time. And because "this" inside the function is the current element, you can actually do some very cool stuff with it. ###The Target Option The target option is a special option that's available on all commands. It allows you to target childrens of the current element, so it's very usefull for stuff where you need to apply the same command to multiple elements. Here's an example where we limit the character count for every li element:
  • jkdhfajksdf fdsjafhkj fkha jkdfajkslhf jkshjhl
  • jdhj ghs fdsgh jdsjg dflshg jfdghsjk jfdsjg
  • dfjhdjsh dfjks fgjg dsjgdfs
Here are some example values for target: - children: Selects the immediate children - children.li: Selects the immediate children of element type "li" - children.li.myclass: Selects the immediate children of element type "li" with class "myclass" - each: Selects all containing elements (be carefull with this one!) - each.h3: Selects all containing elements of type "h3" ###Escaping Sometimes you may need to use one of the protected characters inside an option value. In such a case, all you need is to escape the character with "\". Here's an example where we escape the "=" character inside the condition option value:

###Defaults Each command comes with default settings. So for example this two lines do exactly the same: To the top! To the top! You can define your own defaults on plugin init like this: You can find all the original defaults by looking at the jKit source code, they are right at the top. ###Replacements jKit is a pretty small library and we don't want to make it bigger than about half the size of jQuery. This makes it impossible to create some big implementations for a command with tons of options and beautiful visuals. But don't worry, there's a way to replace the implementation of a command with an extended version. We will publish every command replacement right on the command page, so you always know what's available. You can easely add replacements on jKit init like this: As you can see, you don't have to dublicate the whole commands code if you just want to add a little bit at the end, just use the following line to execute the original code first: this.executeCommand(that, type, options); ###Plugins Another great way to use more cool stuff that isn't implemented inside jKit is with the plugin command. You can add plugins on init like this: You can than use them like this: There are basically two kind of jQuery plugins you can use: If you are a plugin developer, follow this two patterns and your plugin should be jKit compatible! Currently Available Commands -------- - background - hide - remove - show - showandhide - loop - limit - scroll - lightbox - partially - random - slideshow - gallery - tabs - accordion - carousel - parallax - animation - menu - tooltip - form - validate - plugin - lorem - binding - macro - template - chart - encode - split - live - key - ajax - replace - cycle - fontsize - swap - ticker - sort - zoom - api

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。