修改集团客户化内容
This commit is contained in:
@@ -0,0 +1,624 @@
|
||||
/*
|
||||
Background Stretcher jQuery Plugin
|
||||
© 2011 ajaxBlender.com
|
||||
For any questions please visit www.ajaxblender.com
|
||||
or email us at support@ajaxblender.com
|
||||
|
||||
Version: 2.0.1
|
||||
*/
|
||||
|
||||
;(function($){
|
||||
/* Variables */
|
||||
var container = null;
|
||||
var allLIs = '', containerStr = '';
|
||||
|
||||
var element = this;
|
||||
var _bgStretcherPause = false;
|
||||
var _bgStretcherAction = false;
|
||||
var _bgStretcherTm = null;
|
||||
var random_line = new Array();
|
||||
var random_temp = new Array();
|
||||
var r_image = 0;
|
||||
var swf_mode = false;
|
||||
var img_options = new Array();
|
||||
|
||||
$.fn.bgStretcher = function(settings){
|
||||
|
||||
if ($('.bgstretcher-page').length || $('.bgstretcher-area').length) {
|
||||
if(typeof(console) !== 'undefined' && console != null) console.log('More than one bgStretcher');
|
||||
return false;
|
||||
}
|
||||
settings = $.extend({}, $.fn.bgStretcher.defaults, settings);
|
||||
$.fn.bgStretcher.settings = settings;
|
||||
|
||||
function _build(body_content){
|
||||
if(!settings.images.length){ return; }
|
||||
|
||||
_genHtml(body_content);
|
||||
|
||||
containerStr = '#' + settings.imageContainer;
|
||||
container = $(containerStr);
|
||||
allLIs = '#' + settings.imageContainer + ' LI';
|
||||
$(allLIs).hide().css({'z-index': 1, overflow: 'hidden'});
|
||||
|
||||
if(!container.length){ return; }
|
||||
$(window).resize(function(){
|
||||
_resize(body_content)
|
||||
});
|
||||
|
||||
_resize(body_content);
|
||||
|
||||
var stratElement = 0;
|
||||
/* Rebuild images for simpleSlide */
|
||||
if (settings.transitionEffect == 'simpleSlide') {
|
||||
if (settings.sequenceMode == 'random') {
|
||||
if(typeof(console) !== 'undefined' && console != null) {
|
||||
console.log('Effect \'simpleSlide\' don\'t be to use with mode random.');
|
||||
console.log('Mode was automaticly set in normal.');
|
||||
}
|
||||
}
|
||||
$(allLIs).css({'float': 'left', position: 'static'});
|
||||
$(allLIs).show();
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'NW' || $.fn.bgStretcher.settings.slideDirection == 'NE') {
|
||||
$.fn.bgStretcher.settings.slideDirection = 'N';
|
||||
}
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'SW' || $.fn.bgStretcher.settings.slideDirection == 'SE') {
|
||||
$.fn.bgStretcher.settings.slideDirection = 'S';
|
||||
}
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'S' || $.fn.bgStretcher.settings.slideDirection == 'E') {
|
||||
settings.sequenceMode = 'back';
|
||||
$(allLIs).removeClass('bgs-current');
|
||||
$(allLIs).eq($(allLIs).length - $.fn.bgStretcher.settings.startElementIndex - 1).addClass('bgs-current');
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'E') {
|
||||
l = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).width()*(-1);
|
||||
t = 0;
|
||||
} else { // S
|
||||
t = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).height()*(-1);
|
||||
l = 0;
|
||||
}
|
||||
$(containerStr+' UL').css({left: l+'px', top: t+'px'});
|
||||
} else {
|
||||
settings.sequenceMode = 'normal';
|
||||
if ($.fn.bgStretcher.settings.startElementIndex != 0) {
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'N') {
|
||||
t = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).height()*(-1);
|
||||
l = 0;
|
||||
} else { // W
|
||||
l = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).width()*(-1);
|
||||
t = 0;
|
||||
console.log(l);
|
||||
}
|
||||
$(containerStr+' UL').css({left: l+'px', top: t+'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($(settings.buttonNext).length || $(settings.buttonPrev).length || $(settings.pagination).length){
|
||||
if (settings.sequenceMode == 'random') {
|
||||
if(typeof(console) !== 'undefined' && console != null) {
|
||||
console.log('Don\'t use random mode width prev-button, next-button and pagination.');
|
||||
}
|
||||
} else {
|
||||
/* Prev and Next Buttons init */
|
||||
if ($(settings.buttonPrev).length){
|
||||
$(settings.buttonPrev).addClass('bgStretcherNav bgStretcherNavPrev');
|
||||
$(settings.buttonPrev).click(function(){
|
||||
$.fn.bgStretcher.buttonSlide('prev');
|
||||
});
|
||||
}
|
||||
if ($(settings.buttonNext).length){
|
||||
$(settings.buttonNext).addClass('bgStretcherNav bgStretcherNavNext');
|
||||
$(settings.buttonNext).click(function(){
|
||||
$.fn.bgStretcher.buttonSlide('next');
|
||||
});
|
||||
}
|
||||
/* Pagination */
|
||||
if ($(settings.pagination).length) {
|
||||
$.fn.bgStretcher.pagination();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Random mode init */
|
||||
if (settings.sequenceMode == 'random') {
|
||||
var i = Math.floor(Math.random()*$(allLIs).length);
|
||||
$.fn.bgStretcher.buildRandom(i);
|
||||
if (settings.transitionEffect != 'simpleSlide') {
|
||||
$.fn.bgStretcher.settings.startElementIndex = i;
|
||||
}
|
||||
stratElement = i;
|
||||
} else {
|
||||
if ($.fn.bgStretcher.settings.startElementIndex > ($(allLIs).length - 1)) $.fn.bgStretcher.settings.startElementIndex = 0;
|
||||
stratElement = $.fn.bgStretcher.settings.startElementIndex;
|
||||
if (settings.transitionEffect == 'simpleSlide') {
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'S' || $.fn.bgStretcher.settings.slideDirection == 'E') {
|
||||
stratElement = $(allLIs).length - 1 - $.fn.bgStretcher.settings.startElementIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(allLIs).eq(stratElement).show().addClass('bgs-current');
|
||||
$.fn.bgStretcher.loadImg($(allLIs).eq(stratElement));
|
||||
|
||||
/* Go slideshow */
|
||||
if(settings.slideShow && $(allLIs).length > 1){
|
||||
_bgStretcherTm = setTimeout('$.fn.bgStretcher.slideShow(\''+$.fn.bgStretcher.settings.sequenceMode+'\', -1)', settings.nextSlideDelay);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function _resize(body_content){
|
||||
var winW = 0;
|
||||
var winH = 0;
|
||||
var contH = 0;
|
||||
var contW = 0;
|
||||
|
||||
if ($('BODY').hasClass('bgStretcher-container')) {
|
||||
winW = $(window).width();
|
||||
winH = $(window).height();
|
||||
if (($.browser.msie) && (parseInt(jQuery.browser.version) == 6)) {
|
||||
$(window).scroll(function(){
|
||||
$('#'+settings.imageContainer).css('top', $(window).scrollTop());
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$('.bgstretcher').css('position', 'absolute').css('top', '0px');
|
||||
winW = body_content.width();
|
||||
winH = body_content.height();
|
||||
}
|
||||
|
||||
var imgW = 0, imgH = 0;
|
||||
var leftSpace = 0;
|
||||
|
||||
// Max image size
|
||||
if(settings.maxWidth != 'auto'){
|
||||
if (winW > settings.maxWidth){
|
||||
leftSpace = (winW - settings.maxWidth)/2;
|
||||
contW = settings.maxWidth;
|
||||
} else contW = winW;
|
||||
} else contW = winW;
|
||||
if(settings.maxHeight != 'auto'){
|
||||
if (winH > settings.maxHeight){
|
||||
contH = settings.maxHeight;
|
||||
} else contH = winH;
|
||||
} else contH = winH;
|
||||
|
||||
// Update container's size
|
||||
container.width(contW);
|
||||
container.height(contH);
|
||||
|
||||
// Non-proportional resize
|
||||
if(!settings.resizeProportionally){
|
||||
imgW = contH;
|
||||
imgH = contH;
|
||||
} else {
|
||||
var initW = settings.imageWidth, initH = settings.imageHeight;
|
||||
var ratio = initH / initW;
|
||||
|
||||
imgW = contW;
|
||||
imgH = Math.round(contW * ratio);
|
||||
|
||||
if(imgH < contH){
|
||||
imgH = contH;
|
||||
imgW = Math.round(imgH / ratio);
|
||||
}
|
||||
}
|
||||
|
||||
// Anchoring
|
||||
var mar_left = 0;
|
||||
var mar_top = 0;
|
||||
var anchor_arr;
|
||||
if ($.fn.bgStretcher.settings.anchoring != 'left top') {
|
||||
anchor_arr = ($.fn.bgStretcher.settings.anchoring).split(' ');
|
||||
if (anchor_arr[0] == 'right') {
|
||||
mar_left = (winW - contW);
|
||||
} else {
|
||||
if (anchor_arr[0] == 'center') mar_left = Math.round((winW - contW)/2);
|
||||
}
|
||||
if (anchor_arr[1] == 'bottom') {
|
||||
mar_top = (winH - contH);
|
||||
} else {
|
||||
if (anchor_arr[1] == 'center') {
|
||||
mar_top = Math.round((winH - contH)/2);
|
||||
}
|
||||
}
|
||||
container.css('marginLeft', mar_left+'px').css('marginTop', mar_top+'px');
|
||||
}
|
||||
mar_left = 0;
|
||||
mar_top = 0;
|
||||
if ($.fn.bgStretcher.settings.anchoringImg != 'left top') {
|
||||
anchor_arr = ($.fn.bgStretcher.settings.anchoringImg).split(' ');
|
||||
if (anchor_arr[0] == 'right') {
|
||||
mar_left = (contW - imgW);
|
||||
} else {
|
||||
if (anchor_arr[0] == 'center') mar_left = Math.round((contW - imgW)/2);
|
||||
}
|
||||
if (anchor_arr[1] == 'bottom') {
|
||||
mar_top = (contH - imgH);
|
||||
} else {
|
||||
if (anchor_arr[1] == 'center') {
|
||||
mar_top = Math.round((contH - imgH)/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
img_options['mar_left'] = mar_left;
|
||||
img_options['mar_top'] = mar_top;
|
||||
|
||||
// Apply new size for images
|
||||
if (container.find('LI:first').hasClass('swf-mode')) {
|
||||
|
||||
var path_swf = container.find('LI:first').html();
|
||||
container.find('LI:first').html('<div id="bgstretcher-flash"> </div>');
|
||||
|
||||
var header = new SWFObject('flash/stars.swf', 'flash-obj', contW, contH, '9');
|
||||
header.addParam('wmode', 'transparent');
|
||||
header.write('bgstretcher-flash');
|
||||
|
||||
};
|
||||
img_options['imgW'] = imgW;
|
||||
img_options['imgH'] = imgH;
|
||||
|
||||
if(!settings.resizeAnimate){
|
||||
container.children('UL').children('LI.img-loaded').find('IMG').css({'marginLeft': img_options["mar_left"]+'px', 'marginTop': img_options["mar_top"]+'px'});
|
||||
container.children('UL').children('LI.img-loaded').find('IMG').css({'width': img_options["imgW"]+'px', 'height': img_options["imgH"]+'px'});
|
||||
} else {
|
||||
container.children('UL').children('LI.img-loaded').find('IMG').animate({'marginLeft': img_options["mar_left"]+'px', 'marginTop': img_options["mar_top"]+'px'}, 'normal');
|
||||
container.children('UL').children('LI.img-loaded').find('IMG').animate({'width': img_options["imgW"]+'px', 'height': img_options["imgH"]+'px'}, 'normal');
|
||||
}
|
||||
|
||||
$(allLIs).width(container.width()).height(container.height());
|
||||
|
||||
if ($.fn.bgStretcher.settings.transitionEffect == 'simpleSlide') {
|
||||
if ($.fn.bgStretcher.settings.slideDirection == 'W' || $.fn.bgStretcher.settings.slideDirection == 'E') {
|
||||
container.children('UL').width(container.width() * $(allLIs).length).height(container.height());
|
||||
if ( $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) != -1 ){
|
||||
l = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * container.width()*(-1);
|
||||
container.children('UL').css({left: l+'px'});
|
||||
}
|
||||
} else {
|
||||
container.children('UL').height(container.height() * $(allLIs).length).width(container.width());
|
||||
if ( $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) != -1 ){
|
||||
t = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).height()*(-1);
|
||||
container.children('UL').css({top: t+'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function _genHtml(body_content){
|
||||
var code = '';
|
||||
var cur_bgstretcher;
|
||||
|
||||
body_content.each(function(){
|
||||
$(this).wrapInner('<div class="bgstretcher-page" />').wrapInner('<div class="bgstretcher-area" />');
|
||||
code = '<div id="' + settings.imageContainer + '" class="bgstretcher"><ul>';
|
||||
// if swf
|
||||
if (settings.images.length) {
|
||||
var ext = settings.images[0].split('.');
|
||||
ext = ext[ext.length-1];
|
||||
|
||||
if (ext != 'swf') {
|
||||
var ind = 0;
|
||||
for(i = 0; i < settings.images.length; i++){
|
||||
if (settings.transitionEffect == 'simpleSlide' && settings.sequenceMode == 'back')
|
||||
ind = settings.images.length-1-i;
|
||||
else ind = i;
|
||||
if ($.fn.bgStretcher.settings.preloadImg) {
|
||||
code += '<li><span class="image-path">' + settings.images[ind] + '</span></li>';
|
||||
} else {
|
||||
code += '<li class="img-loaded"><img src="' + settings.images[ind] + '" alt="" /></li>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
code += '<li class="swf-mode">' + settings.images[0] + '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
code += '</ul></div>';
|
||||
cur_bgstretcher = $(this).children('.bgstretcher-area');
|
||||
$(code).prependTo(cur_bgstretcher);
|
||||
cur_bgstretcher.css({position: 'relative'});
|
||||
cur_bgstretcher.children('.bgstretcher-page').css({'position': 'relative', 'z-index': 3});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/* Start bgStretcher */
|
||||
this.addClass('bgStretcher-container');
|
||||
_build(this);
|
||||
};
|
||||
|
||||
$.fn.bgStretcher.loadImg = function(obj){
|
||||
if (obj.hasClass('img-loaded')) return true;
|
||||
obj.find('SPAN.image-path').each(function(){
|
||||
var imgsrc = $(this).html();
|
||||
var imgalt = '';
|
||||
var parent = $(this).parent();
|
||||
var img = new Image();
|
||||
|
||||
$(img).load(function () {
|
||||
$(this).hide();
|
||||
parent.prepend(this);
|
||||
$(this).fadeIn('100');
|
||||
}).error(function () {
|
||||
}).attr('src', imgsrc).attr('alt', imgalt);
|
||||
|
||||
$(img).css({'marginLeft': img_options["mar_left"]+'px', 'marginTop': img_options["mar_top"]+'px'});
|
||||
$(img).css({'width': img_options["imgW"]+'px', 'height': img_options["imgH"]+'px'});
|
||||
});
|
||||
obj.addClass('img-loaded');
|
||||
return true;
|
||||
}
|
||||
|
||||
$.fn.bgStretcher.play = function(){
|
||||
_bgStretcherPause = false;
|
||||
$.fn.bgStretcher._clearTimeout();
|
||||
$.fn.bgStretcher.slideShow($.fn.bgStretcher.settings.sequenceMode, -1);
|
||||
|
||||
};
|
||||
|
||||
$.fn.bgStretcher._clearTimeout = function(){
|
||||
if(_bgStretcherTm != null){
|
||||
clearTimeout(_bgStretcherTm);
|
||||
_bgStretcherTm = null;
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.bgStretcher.pause = function(){
|
||||
_bgStretcherPause = true;
|
||||
$.fn.bgStretcher._clearTimeout();
|
||||
};
|
||||
|
||||
$.fn.bgStretcher.sliderDestroy = function(){
|
||||
var cont = $('.bgstretcher-page').html();
|
||||
$('.bgStretcher-container').html('').html(cont).removeClass('bgStretcher-container');
|
||||
$.fn.bgStretcher._clearTimeout();
|
||||
_bgStretcherPause = false;
|
||||
}
|
||||
|
||||
/* Slideshow */
|
||||
$.fn.bgStretcher.slideShow = function(sequence_mode, index_next){
|
||||
_bgStretcherAction = true;
|
||||
if ($(allLIs).length < 2) return true;
|
||||
var current = $(containerStr + ' LI.bgs-current');
|
||||
var next;
|
||||
|
||||
if (index_next == -1) {
|
||||
switch (sequence_mode){
|
||||
case 'back':
|
||||
next = current.prev();
|
||||
if(!next.length){ next = $(containerStr + ' LI:last'); }
|
||||
break;
|
||||
case 'random':
|
||||
if (r_image == $(containerStr + ' LI').length) {
|
||||
$.fn.bgStretcher.buildRandom(random_line[$(containerStr + ' LI').length-1]);
|
||||
r_image = 0;
|
||||
}
|
||||
next = $(containerStr + ' LI').eq(random_line[r_image]);
|
||||
r_image++;
|
||||
break;
|
||||
default:
|
||||
next = current.next();
|
||||
if(!next.length){ next = $(containerStr + ' LI:first'); }
|
||||
}
|
||||
} else {
|
||||
next = $(containerStr + ' LI').eq(index_next);
|
||||
}
|
||||
|
||||
$(containerStr + ' LI').removeClass('bgs-current');
|
||||
$.fn.bgStretcher.loadImg(next);
|
||||
next.addClass('bgs-current');
|
||||
|
||||
switch ($.fn.bgStretcher.settings.transitionEffect){
|
||||
case 'fade':
|
||||
$.fn.bgStretcher.effectFade(current, next);
|
||||
break;
|
||||
case 'simpleSlide':
|
||||
$.fn.bgStretcher.simpleSlide();
|
||||
break;
|
||||
case 'superSlide':
|
||||
$.fn.bgStretcher.superSlide(current, next, sequence_mode);
|
||||
break;
|
||||
default :
|
||||
$.fn.bgStretcher.effectNone(current, next);
|
||||
|
||||
}
|
||||
if ($($.fn.bgStretcher.settings.pagination).find('LI').length) {
|
||||
$($.fn.bgStretcher.settings.pagination).find('LI.showPage').removeClass('showPage');
|
||||
$($.fn.bgStretcher.settings.pagination).find('LI').eq($(containerStr + ' LI').index($(containerStr + ' LI.bgs-current'))).addClass('showPage');
|
||||
}
|
||||
|
||||
// callback
|
||||
if ($.fn.bgStretcher.settings.callbackfunction) {
|
||||
if(typeof $.fn.bgStretcher.settings.callbackfunction == 'function')
|
||||
$.fn.bgStretcher.settings.callbackfunction.call();
|
||||
}
|
||||
|
||||
if(!_bgStretcherPause){
|
||||
_bgStretcherTm = setTimeout('$.fn.bgStretcher.slideShow(\''+$.fn.bgStretcher.settings.sequenceMode+'\', -1)', $.fn.bgStretcher.settings.nextSlideDelay);
|
||||
}
|
||||
};
|
||||
|
||||
/* Others effects */
|
||||
$.fn.bgStretcher.effectNone = function(current, next){
|
||||
next.show();
|
||||
current.hide();
|
||||
_bgStretcherAction = false;
|
||||
};
|
||||
$.fn.bgStretcher.effectFade = function(current, next){
|
||||
next.fadeIn( $.fn.bgStretcher.settings.slideShowSpeed );
|
||||
current.fadeOut( $.fn.bgStretcher.settings.slideShowSpeed, function(){
|
||||
_bgStretcherAction = false;
|
||||
} );
|
||||
};
|
||||
|
||||
$.fn.bgStretcher.simpleSlide = function(){
|
||||
var t, l;
|
||||
switch ($.fn.bgStretcher.settings.slideDirection) {
|
||||
case 'N':
|
||||
case 'S':
|
||||
t = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).height()*(-1);
|
||||
l = 0;
|
||||
break;
|
||||
default:
|
||||
l = $(containerStr + ' LI').index($(containerStr + ' LI.bgs-current')) * $(containerStr).width()*(-1);
|
||||
t = 0;
|
||||
}
|
||||
$(containerStr+' UL').animate({left: l+'px', top: t+'px'}, $.fn.bgStretcher.settings.slideShowSpeed, function(){
|
||||
_bgStretcherAction = false;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$.fn.bgStretcher.superSlide = function(current, next, sequence_mode){
|
||||
var t, l;
|
||||
switch ($.fn.bgStretcher.settings.slideDirection) {
|
||||
case 'S':
|
||||
t = $(containerStr).height();
|
||||
l = 0;
|
||||
break;
|
||||
case 'E':
|
||||
t = 0;
|
||||
l = $(containerStr).width();
|
||||
break;
|
||||
case 'W':
|
||||
t = 0;
|
||||
l = $(containerStr).width()*(-1);
|
||||
break;
|
||||
case 'NW':
|
||||
t = $(containerStr).height()*(-1);
|
||||
l = $(containerStr).width()*(-1);
|
||||
break;
|
||||
case 'NE':
|
||||
t = $(containerStr).height()*(-1);
|
||||
l = $(containerStr).width();
|
||||
break;
|
||||
case 'SW':
|
||||
t = $(containerStr).height();
|
||||
l = $(containerStr).width()*(-1);
|
||||
break;
|
||||
case 'SE':
|
||||
t = $(containerStr).height();
|
||||
l = $(containerStr).width();
|
||||
break;
|
||||
default:
|
||||
t = $(containerStr).height()*(-1);
|
||||
l = 0;
|
||||
|
||||
}
|
||||
|
||||
if (sequence_mode == 'back') {
|
||||
next.css({'z-index': 2, top: t+'px', left: l+'px'});
|
||||
next.show();
|
||||
next.animate({left: '0px', top: '0px'}, $.fn.bgStretcher.settings.slideShowSpeed, function(){
|
||||
current.hide();
|
||||
$(this).css({'z-index': 1});
|
||||
_bgStretcherAction = false;
|
||||
});
|
||||
} else {
|
||||
current.css('z-index', 2);
|
||||
next.show();
|
||||
current.animate({left: l+'px', top: t+'px'}, $.fn.bgStretcher.settings.slideShowSpeed, function(){
|
||||
$(this).hide().css({'z-index': 1, top: '0px', left: '0px'});
|
||||
_bgStretcherAction = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* Build line random images */
|
||||
$.fn.bgStretcher.buildRandom = function(el_not){
|
||||
var l = $(allLIs).length;
|
||||
var i, j, rt;
|
||||
for (i = 0; i < l; i++ ) {
|
||||
random_line[i] = i;
|
||||
random_temp[i] = Math.random()*l;
|
||||
}
|
||||
for (i = 0; i < l; i++ ) {
|
||||
for (j = 0; j < (l-i-1); j++) {
|
||||
if (random_temp[j] > random_temp[j+1]) {
|
||||
rt = random_temp[j];
|
||||
random_temp[j] = random_temp[j+1];
|
||||
random_temp[j+1] = rt;
|
||||
rt = random_line[j];
|
||||
random_line[j] = random_line[j+1];
|
||||
random_line[j+1] = rt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (random_line[0] == el_not) {
|
||||
rt = random_line[0];
|
||||
random_line[0] = random_line[l-1];
|
||||
random_line[l-1] = rt;
|
||||
}
|
||||
};
|
||||
|
||||
/* Prev and Next buttons */
|
||||
$.fn.bgStretcher.buttonSlide = function(button_point){
|
||||
if (_bgStretcherAction || ($(allLIs).length < 2)) return false;
|
||||
var mode = '';
|
||||
if (button_point == 'prev') {
|
||||
mode = 'back';
|
||||
if ($.fn.bgStretcher.settings.sequenceMode == 'back') mode = 'normal';
|
||||
} else {
|
||||
mode = $.fn.bgStretcher.settings.sequenceMode;
|
||||
}
|
||||
$(allLIs).stop(true, true);
|
||||
$.fn.bgStretcher._clearTimeout();
|
||||
$.fn.bgStretcher.slideShow(mode, -1);
|
||||
return false;
|
||||
};
|
||||
|
||||
/* Pagination */
|
||||
$.fn.bgStretcher.pagination = function(){
|
||||
var l = $(allLIs).length;
|
||||
var output = ''; var i = 0;
|
||||
if (l > 0) {
|
||||
output += '<ul>';
|
||||
for (i = 0; i < l; i++){
|
||||
output += '<li><a href="javascript:;">'+(i+1)+'</a></li>';
|
||||
}
|
||||
output += '</ul>';
|
||||
$($.fn.bgStretcher.settings.pagination).html(output);
|
||||
$($.fn.bgStretcher.settings.pagination).find('LI:first').addClass('showPage');
|
||||
|
||||
$($.fn.bgStretcher.settings.pagination).find('A').click(function(){
|
||||
if ($(this).parent().hasClass('showPage')) return false;
|
||||
$(allLIs).stop(true, true);
|
||||
$.fn.bgStretcher._clearTimeout();
|
||||
$.fn.bgStretcher.slideShow($.fn.bgStretcher.settings.sequenceMode, $($.fn.bgStretcher.settings.pagination).find('A').index($(this)));
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Settings */
|
||||
$.fn.bgStretcher.defaults = {
|
||||
imageContainer: 'bgstretcher',
|
||||
resizeProportionally: true,
|
||||
resizeAnimate: false,
|
||||
images: [],
|
||||
imageWidth: 1024,
|
||||
imageHeight: 768,
|
||||
maxWidth: 'auto',
|
||||
maxHeight: 'auto',
|
||||
nextSlideDelay: 3000,
|
||||
slideShowSpeed: 'normal',
|
||||
slideShow: true,
|
||||
transitionEffect: 'fade', // none, fade, simpleSlide, superSlide
|
||||
slideDirection: 'N', // N, S, W, E, (if superSlide - NW, NE, SW, SE)
|
||||
sequenceMode: 'normal', // back, random
|
||||
buttonPrev: '',
|
||||
buttonNext: '',
|
||||
pagination: '',
|
||||
anchoring: 'left top', // right bottom center
|
||||
anchoringImg: 'left top', // right bottom center
|
||||
preloadImg: false,
|
||||
startElementIndex: 0,
|
||||
callbackfunction: null
|
||||
};
|
||||
$.fn.bgStretcher.settings = {};
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,154 @@
|
||||
function drawCircle(obj) {
|
||||
var drawing_elem = document.getElementById(obj.drawing_elem);
|
||||
var width = drawing_elem.width;
|
||||
var height = drawing_elem.height;
|
||||
var percent = +drawing_elem.getAttribute("data-value");
|
||||
var percentfontcolor = obj.percentfontcolor;
|
||||
var unitfontcolor = obj.unitfontcolor;
|
||||
var percentfontsize = obj.percentfontsize || 15;
|
||||
var unitfontsize = obj.unitfontsize || 15;
|
||||
var unitvalue = obj.unitvalue || "%";
|
||||
var bgcolor = obj.bgcolor || "";
|
||||
var forecolor = obj.forecolor;
|
||||
var lineWidth = obj.lineWidth || 12;
|
||||
var speedstep = obj.speedstep || 3;
|
||||
var addLeft = obj.addLeft || 0;
|
||||
var lineGap = obj.lineGap || "";
|
||||
var center_x = width / 2;
|
||||
var center_y = height / 2;
|
||||
var rad = obj.rad || (Math.PI * 2) / 100;
|
||||
var radStart = obj.radStart || 0;
|
||||
var radEnd = obj.radEnd || Math.PI * 2;
|
||||
var radDrawStart = obj.radDrawStart || (-Math.PI * 1) / 2;
|
||||
var unitadd = obj.unitadd || (-Math.PI * 1) / 2;
|
||||
var speed = 0;
|
||||
|
||||
var context = drawing_elem.getContext("2d");
|
||||
|
||||
// 绘制背景圆圈
|
||||
function drawOuterCircle() {
|
||||
context.save();
|
||||
context.lineWidth = lineWidth;
|
||||
var radius = center_x - context.lineWidth;
|
||||
if (Object.prototype.toString.call(bgcolor) === "[object Array]") {
|
||||
var gradient = context.createLinearGradient(height, 0, 0, 0);
|
||||
bgcolor.forEach(function (item) {
|
||||
gradient.addColorStop(item.step, item.color);
|
||||
});
|
||||
context.strokeStyle = gradient;
|
||||
} else {
|
||||
context.strokeStyle = bgcolor;
|
||||
}
|
||||
if (lineGap) {
|
||||
context.lineCap = lineGap;
|
||||
}
|
||||
context.beginPath();
|
||||
context.arc(center_x, center_y, radius, radStart, radEnd, false);
|
||||
context.stroke();
|
||||
context.closePath();
|
||||
context.restore();
|
||||
}
|
||||
|
||||
//绘制运动圆环
|
||||
function drawInnerCircle(n) {
|
||||
context.save();
|
||||
context.lineWidth = lineWidth;
|
||||
var radius = center_x - context.lineWidth;
|
||||
if (Object.prototype.toString.call(forecolor) === "[object Array]") {
|
||||
var gradient = context.createLinearGradient(height, 0, 0, 0);
|
||||
forecolor.forEach(function (item) {
|
||||
gradient.addColorStop(item.step, item.color);
|
||||
});
|
||||
context.strokeStyle = gradient;
|
||||
} else {
|
||||
context.strokeStyle = forecolor;
|
||||
}
|
||||
if (lineGap) {
|
||||
context.lineCap = lineGap;
|
||||
}
|
||||
context.beginPath();
|
||||
context.arc(
|
||||
center_x,
|
||||
center_y,
|
||||
radius,
|
||||
radDrawStart,
|
||||
radDrawStart + n * rad,
|
||||
false
|
||||
);
|
||||
context.stroke();
|
||||
context.closePath();
|
||||
context.restore();
|
||||
}
|
||||
|
||||
//绘制文字
|
||||
function drawText(n) {
|
||||
//声明%
|
||||
context.save();
|
||||
context.font = unitfontsize + "px Helvetica";
|
||||
var text1_width = context.measureText(unitvalue).width;
|
||||
context.restore();
|
||||
|
||||
//绘制数字
|
||||
context.save();
|
||||
var font_size = percentfontsize;
|
||||
var text_value = "";
|
||||
if (n % parseInt(n) > 0 && n % parseInt(n) < 1) {
|
||||
text_value = n.toFixed(2);
|
||||
} else if (n % parseInt(n) === 0 || n == 0) {
|
||||
text_value = n.toFixed(0);
|
||||
}
|
||||
context.fillStyle = percentfontcolor;
|
||||
context.font = font_size + "px Helvetica";
|
||||
var text_width = context.measureText(text_value).width;
|
||||
context.fillText(
|
||||
text_value,
|
||||
center_x - text_width / 2 - text1_width / 2 + addLeft,
|
||||
center_y + font_size / 2
|
||||
);
|
||||
context.restore();
|
||||
|
||||
//绘制%
|
||||
context.save();
|
||||
context.fillStyle = unitfontcolor;
|
||||
context.fillText(
|
||||
unitvalue,
|
||||
center_x - text_width / 2 + text_width - text1_width / 2 + addLeft,
|
||||
center_y + unitfontsize / 2 + unitadd
|
||||
);
|
||||
context.restore();
|
||||
}
|
||||
|
||||
// 绘制
|
||||
function startDraw(speed) {
|
||||
context.save();
|
||||
context.clearRect(0, 0, width, height);
|
||||
if (bgcolor) {
|
||||
drawOuterCircle();
|
||||
}
|
||||
drawText(speed);
|
||||
if (speed != 0) {
|
||||
drawInnerCircle(speed);
|
||||
}
|
||||
context.restore();
|
||||
}
|
||||
|
||||
// 执行动画
|
||||
(function drawFrame() {
|
||||
if (percent == 0) {
|
||||
startDraw(speed);
|
||||
return;
|
||||
}
|
||||
if (speed >= percent) {
|
||||
speed = percent;
|
||||
startDraw(speed);
|
||||
return;
|
||||
}
|
||||
if (percent - speed >= speedstep) {
|
||||
speed += speedstep;
|
||||
} else {
|
||||
speed += percent - speed;
|
||||
}
|
||||
startDraw(speed);
|
||||
window.requestAnimationFrame(drawFrame);
|
||||
})();
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
http://www.rjboy.cn
|
||||
By sean at 2010.06 - 2011.03
|
||||
|
||||
Demo:
|
||||
$(".container").hScrollPane({
|
||||
mover:".press", //指定container对象下的哪个元素需要滚动位置 | 必传项;
|
||||
moverW:function(){return $(".press").width();}(), //传入水平滚动对象的长度值,不传入的话默认直接获取mover的宽度值 | 可选项;
|
||||
handleMinWidth:300, //指定handle的最小宽度,要固定handle的宽度请在css中设定handle的width属性(如 width:28px!important;),不传入则不设定最小宽度 | 可选项;
|
||||
showArrow:true, //指定是否显示左右箭头,默认不显示 | 可选项;
|
||||
dragable:false, //指定是否要支持拖动效果,默认可以拖动 | 可选项;
|
||||
handleCssAlter:"draghandlealter", //指定拖动鼠标时滚动条的样式,不传入该参数则没有变化效果 | 可选项;
|
||||
easing:true, //滚动是否需要滑动效果,默认有滑动效果 | 可选项;
|
||||
mousewheel:{bind:true,moveLength:500} //mousewheel: bind->'true',绑定mousewheel事件; ->'false',不绑定mousewheel事件;moveLength是指定鼠标滚动一次移动的距离,默认值:{bind:true,moveLength:300} | 可选项;
|
||||
});
|
||||
*/
|
||||
|
||||
(function($){
|
||||
$.extend(jQuery.easing,{
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.hScrollPane=function(settings){
|
||||
settings=$.extend(true,{},$.fn.hScrollPane.defaults,settings);
|
||||
this.each(function(){
|
||||
var container=$(this),
|
||||
mover=container.find(settings.mover),
|
||||
w=container.width(),
|
||||
c=settings.moverW || mover.width(),
|
||||
dragbar=(container.find(".hScrollPane_dragbar").length==0 && c>w ) ? container.append('<div class="hScrollPane_dragbar"><div class="hScrollPane_draghandle"></div></div>').find(".hScrollPane_dragbar") : container.find(".hScrollPane_dragbar"),//避免多次初始化时的重复append;
|
||||
handle=dragbar.find(".hScrollPane_draghandle");
|
||||
|
||||
if(settings.showArrow){
|
||||
container.append('<a href="###" class="hScrollPane_leftarrow"></a><a href="###" class="hScrollPane_rightarrow"></a>');
|
||||
leftArrow=container.find(".hScrollPane_leftarrow");
|
||||
rightArrow=container.find(".hScrollPane_rightarrow");
|
||||
dragbar.css({
|
||||
width:container.width()-leftArrow.outerWidth()*2,
|
||||
left:leftArrow.outerWidth()
|
||||
});
|
||||
leftArrow.unbind();
|
||||
rightArrow.unbind();
|
||||
}else{
|
||||
dragbar.css("width",container.width());
|
||||
}
|
||||
|
||||
mover.stop().css("left","0px");
|
||||
container.unbind();//避免多次初始化时的事件重复绑定;
|
||||
handle.unbind();
|
||||
dragbar.unbind();
|
||||
|
||||
handle.stop().css({
|
||||
width:(w/c)*w >settings.handleMinWidth ? (w/c)*w : settings.handleMinWidth,
|
||||
left:0
|
||||
});
|
||||
|
||||
if(c<w){
|
||||
dragbar.hide();
|
||||
return false;
|
||||
}else{
|
||||
dragbar.show();
|
||||
}
|
||||
|
||||
// 添加
|
||||
container.bind("mouseenter", function(e){
|
||||
console.log('hover')
|
||||
dragbar.css('opacity', 1);
|
||||
})
|
||||
|
||||
container.bind("mouseleave", function(e){
|
||||
dragbar.css('opacity', 0);
|
||||
console.log('hover1')
|
||||
return false;
|
||||
})
|
||||
|
||||
//
|
||||
|
||||
|
||||
var maxlen=parseInt(dragbar.width())-parseInt(handle.outerWidth());
|
||||
|
||||
dragbar.bind("click",function(e){
|
||||
var flag=e.pageX>handle.offset().left+handle.outerWidth() ? -1 : 1;
|
||||
$.fn.hScrollPane.move(settings,mover,handle,w,c,maxlen,flag);
|
||||
});
|
||||
|
||||
handle.bind("mousedown",function(e){
|
||||
var x=e.pageX;
|
||||
var hx=parseInt(handle.css("left"));
|
||||
if(settings.handleCssAlter){$(this).addClass(settings.handleCssAlter);}
|
||||
|
||||
$(document).bind("mousemove",function(e){
|
||||
var left=e.pageX-x+hx<0?0:(e.pageX-x+hx>=maxlen?maxlen:e.pageX-x+hx);
|
||||
handle.stop().css({left:left});
|
||||
if(settings.easing){
|
||||
mover.stop().animate({
|
||||
left:-left/maxlen*(c-w)
|
||||
},{duration:1500,easing:'easeOutQuint',queue:false});
|
||||
}else{
|
||||
mover.css({left:-left/maxlen*(c-w)});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
$(document).bind("mouseup",function(){
|
||||
if(settings.handleCssAlter){handle.removeClass(settings.handleCssAlter);}
|
||||
$(this).unbind("mousemove");
|
||||
})
|
||||
return false;
|
||||
}).click(function(){
|
||||
return false;
|
||||
})
|
||||
|
||||
if(settings.dragable){
|
||||
mover.bind("mousedown",function(e){
|
||||
var x=e.pageX;
|
||||
$(this).bind("mousemove",function(e){
|
||||
$.fn.hScrollPane.move(settings,mover,handle,w,c,maxlen,x,e.pageX);
|
||||
return false;
|
||||
})
|
||||
$(document).bind("mouseup",function(){
|
||||
mover.unbind("mousemove");
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if(settings.mousewheel.bind){
|
||||
container.bind("mousewheel",function(event, delta){
|
||||
$.fn.hScrollPane.move(settings,mover,handle,w,c,maxlen,delta);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if(settings.showArrow){
|
||||
leftArrow.click(function(){
|
||||
$.fn.hScrollPane.move(settings,mover,handle,w,c,maxlen,1);
|
||||
return false;
|
||||
}).focus(function(){this.blur();});
|
||||
|
||||
rightArrow.click(function(){
|
||||
$.fn.hScrollPane.move(settings,mover,handle,w,c,maxlen,-1);
|
||||
return false;
|
||||
}).focus(function(){this.blur();});
|
||||
}
|
||||
|
||||
this.ondragstart=function(){return false;}
|
||||
this.onselectstart=function(){return false;}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.hScrollPane.defaults = {
|
||||
showArrow:false,
|
||||
handleMinWidth:0,
|
||||
dragable:true,
|
||||
easing:true,
|
||||
mousewheel:{bind:true,moveLength:300}
|
||||
};
|
||||
|
||||
$.fn.hScrollPane.move=function(settings,mover,handle,w,c,maxlen,x,nx){
|
||||
if(arguments.length==7){
|
||||
var left=parseInt(mover.css("left"))+x*settings.mousewheel.moveLength;
|
||||
}else{
|
||||
var left=parseInt(mover.css("left"))+((nx-x)/w)*(c-w);
|
||||
}
|
||||
left=left.toFixed(0);
|
||||
left=left>0?0:left<w-c?w-c:left;
|
||||
var handle_left=(left/(w-c))*maxlen;
|
||||
|
||||
if(settings.easing){
|
||||
mover.stop().animate({
|
||||
left:left
|
||||
},{duration:1500,easing:'easeOutQuint',queue:false});
|
||||
|
||||
handle.stop().animate({
|
||||
left:handle_left
|
||||
},{duration:1500,easing:'easeOutQuint',queue:false});
|
||||
}else{
|
||||
mover.stop().animate({
|
||||
left:left
|
||||
},{duration:5,queue:false});
|
||||
|
||||
handle.css({left:handle_left});
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* jQuery Mousewheel 3.1.13
|
||||
*
|
||||
* Copyright 2015 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user