/**
* creates a carousel-style navigation widget for images/any-content from a simple html markup.
*
* the html markup that is used to build the carousel can be as simple as...
*
*
*
*
*
*
*
*
*
* as you can see, this snippet is nothing but a simple div containing an unordered list of images.
* you don't need any special "class" attribute, or a special "css" file for this plugin.
* i am using a class attribute just for the sake of explanation here.
*
* to navigate the elements of the carousel, you need some kind of navigation buttons.
* for example, you will need a "previous" button to go backward, and a "next" button to go forward.
* this need not be part of the carousel "div" itself. it can be any element in your page.
* lets assume that the following elements in your document can be used as next, and prev buttons...
*
*
*
*
* now, all you need to do is call the carousel component on the div element that represents it, and pass in the
* navigation buttons as options.
*
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev"
* });
*
* that's it, you would have now converted your raw div, into a magnificient carousel.
*
* there are quite a few other options that you can use to customize it though.
* each will be explained with an example below.
*
* @param an options object - you can specify all the options shown below as an options object param.
*
* @option btnprev, btnnext : string - no defaults
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev"
* });
* @desc creates a basic carousel. clicking "btnprev" navigates backwards and "btnnext" navigates forward.
*
* @option btngo - array - no defaults
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* btngo: [".0", ".1", ".2"]
* });
* @desc if you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
* the item number within the carousel, you can use this option. just supply an array of selectors for each element
* in the carousel. the index of the array represents the index of the element. what i mean is, if the
* first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
* will slide to the first element and so on and so forth. this feature is very powerful. for example, i made a tabbed
* interface out of it by making my navigation elements styled like tabs in css. as the carousel is capable of holding
* any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
* the best part is that, the tab will "slide" based on the provided effect. :-)
*
* @option mousewheel : boolean - default is false
* @example
* $(".carousel").xyscroll({
* mousewheel: true
* });
* @desc the carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
* to get this feature working, you have to do 2 things. first, you have to include the mouse-wheel plugin from brandon.
* second, you will have to set the option "mousewheel" to true. that's it, now you will be able to navigate your carousel
* using the mouse wheel. using buttons and mousewheel or not mutually exclusive. you can still have buttons for navigation
* as well. they complement each other. to use both together, just supply the options required for both as shown below.
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* mousewheel: true
* });
*
* @option auto : number - default is null, meaning autoscroll is disabled by default
* @example
* $(".carousel").xyscroll({
* auto: 800,
* speed: 500
* });
* @desc you can make your carousel auto-navigate itself by specfying a millisecond value in this option.
* the value you specify is the amount of time between 2 slides. the default is null, and that disables auto scrolling.
* specify this value and magically your carousel will start auto scrolling.
*
* @option speed : number - 200 is default
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* speed: 800
* });
* @desc specifying a speed will slow-down or speed-up the sliding speed of your carousel. try it out with
* different speeds like 800, 600, 1500 etc. providing 0, will remove the slide effect.
*
* @option easing : string - no easing effects by default.
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* easing: "bounceout"
* });
* @desc you can specify any easing effect. note: you need easing plugin for that. once specified,
* the carousel will slide based on the provided easing effect.
*
* @option vertical : boolean - default is false
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* vertical: true
* });
* @desc determines the direction of the carousel. true, means the carousel will display vertically. the next and
* prev buttons will slide the items vertically as well. the default is false, which means that the carousel will
* display horizontally. the next and prev items will slide the items from left-right in this case.
*
* @option circular : boolean - default is true
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* circular: false
* });
* @desc setting it to true enables circular navigation. this means, if you click "next" after you reach the last
* element, you will automatically slide to the first element and vice versa. if you set circular to false, then
* if you click on the "next" button after you reach the last element, you will stay in the last element itself
* and similarly for "previous" button and first element.
*
* @option visible : number - default is 3
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* visible: 4
* });
* @desc this specifies the number of items visible at all times within the carousel. the default is 3.
* you are even free to experiment with real numbers. eg: "3.5" will have 3 items fully visible and the
* last item half visible. this gives you the effect of showing the user that there are more images to the right.
*
* @option start : number - default is 0
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* start: 2
* });
* @desc you can specify from which item the carousel should start. remember, the first item in the carousel
* has a start of 0, and so on.
*
* @option scrool : number - default is 1
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* scroll: 2
* });
* @desc the number of items that should scroll/slide when you click the next/prev navigation buttons. by
* default, only one item is scrolled, but you may set it to any number. eg: setting it to "2" will scroll
* 2 items when you click the next or previous buttons.
*
* @option beforestart, afterend : function - callbacks
* @example
* $(".carousel").xyscroll({
* btnnext: ".next",
* btnprev: ".prev",
* beforestart: function(a) {
* alert("before animation starts:" + a);
* },
* afterend: function(a) {
* alert("after animation ends:" + a);
* }
* });
* @desc if you wanted to do some logic in your page before the slide starts and after the slide ends, you can
* register these 2 callbacks. the functions will be passed an argument that represents an array of elements that
* are visible at the time of callback.
*
*
* @cat plugins/image gallery
* @author ganeshji marwaha/ganeshread@gmail.com
*/
(function($) {
/**
* 去html代码,并判断元素类型,当元素是可输入元素(input,textarea)时同时去左右空格
* 默认可输入元素加类名trim自动加载该功能
*/
$.fn.xystriphtml = function(o){
o = $.extend({}, o || {});
return this.each(function(){
switch($(this).prop('tagname')){
case 'input':
case 'textarea':
$(this).val($.trim($(this).val().replace(/<[^>]+>/g,''))).blur(function(){$(this).val($.trim($(this).val().replace(/<[^>]+>/g,'')))})
break;
default:
$(this).html($(this).html().replace(/<[^>]+>/g,''));
break;
}
})
}
/**
* 屏蔽功能键使用方法:
* $(function(){
* $(form表单).xyprohibit(); 不带参数时默认屏蔽所有功能键
* $(form表单).xyprohibit({'prohibit':['mouseright','mouseleft','alt','ctrl','shift']});
* 参数选择,全部屏蔽等同于不带参数,参数必须以数组形式输入
* })
*/
$.fn.xyprohibit = function(o){
o = $.extend({prohibit:['mouseright','mouseleft','alt','ctrl','shift']}, o || {});
return this.each(function(){
var obj = $(this);
if(jquery.isarray(o.prohibit)){
for(var i=0; i'+$(this).attr('xy-msg')+'';
html_en+='
the selected file is not valid, can be uploaded to the file category ('+$(obj).attr('xy-check-type')+'), since the current browser does not support the html5, the file size can not be verified, please do not upload more than '+$(obj).attr('max')+'mb.