提示框改进
This commit is contained in:
Vendored
+1
-162
@@ -1,6 +1,6 @@
|
||||
/*! jQuery UI - v1.10.3 - 2013-10-16
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.datepicker.js, jquery.ui.slider.js, jquery.ui.effect.js, jquery.ui.effect-bounce.js, jquery.ui.effect-highlight.js, jquery.ui.effect-shake.js
|
||||
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.datepicker.js, jquery.ui.slider.js, jquery.ui.effect.js, jquery.ui.effect-highlight.js
|
||||
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
(function( $, undefined ) {
|
||||
@@ -4943,106 +4943,6 @@ $.each( baseEasings, function( name, easeIn ) {
|
||||
})(jQuery);
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.bounce = function( o, done ) {
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
|
||||
// defaults:
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
hide = mode === "hide",
|
||||
show = mode === "show",
|
||||
direction = o.direction || "up",
|
||||
distance = o.distance,
|
||||
times = o.times || 5,
|
||||
|
||||
// number of internal animations
|
||||
anims = times * 2 + ( show || hide ? 1 : 0 ),
|
||||
speed = o.duration / anims,
|
||||
easing = o.easing,
|
||||
|
||||
// utility:
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
motion = ( direction === "up" || direction === "left" ),
|
||||
i,
|
||||
upAnim,
|
||||
downAnim,
|
||||
|
||||
// we will need to re-assemble the queue to stack our animations in place
|
||||
queue = el.queue(),
|
||||
queuelen = queue.length;
|
||||
|
||||
// Avoid touching opacity to prevent clearType and PNG issues in IE
|
||||
if ( show || hide ) {
|
||||
props.push( "opacity" );
|
||||
}
|
||||
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
$.effects.createWrapper( el ); // Create Wrapper
|
||||
|
||||
// default distance for the BIGGEST bounce is the outer Distance / 3
|
||||
if ( !distance ) {
|
||||
distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
|
||||
}
|
||||
|
||||
if ( show ) {
|
||||
downAnim = { opacity: 1 };
|
||||
downAnim[ ref ] = 0;
|
||||
|
||||
// if we are showing, force opacity 0 and set the initial position
|
||||
// then do the "first" animation
|
||||
el.css( "opacity", 0 )
|
||||
.css( ref, motion ? -distance * 2 : distance * 2 )
|
||||
.animate( downAnim, speed, easing );
|
||||
}
|
||||
|
||||
// start at the smallest distance if we are hiding
|
||||
if ( hide ) {
|
||||
distance = distance / Math.pow( 2, times - 1 );
|
||||
}
|
||||
|
||||
downAnim = {};
|
||||
downAnim[ ref ] = 0;
|
||||
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
|
||||
for ( i = 0; i < times; i++ ) {
|
||||
upAnim = {};
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
el.animate( upAnim, speed, easing )
|
||||
.animate( downAnim, speed, easing );
|
||||
|
||||
distance = hide ? distance * 2 : distance / 2;
|
||||
}
|
||||
|
||||
// Last Bounce when Hiding
|
||||
if ( hide ) {
|
||||
upAnim = { opacity: 0 };
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
el.animate( upAnim, speed, easing );
|
||||
}
|
||||
|
||||
el.queue(function() {
|
||||
if ( hide ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
});
|
||||
|
||||
// inject all the animations we just queued to be first in line (after "inprogress")
|
||||
if ( queuelen > 1) {
|
||||
queue.splice.apply( queue,
|
||||
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
||||
}
|
||||
el.dequeue();
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.highlight = function( o, done ) {
|
||||
var elem = $( this ),
|
||||
props = [ "backgroundImage", "backgroundColor", "opacity" ],
|
||||
@@ -5078,64 +4978,3 @@ $.effects.effect.highlight = function( o, done ) {
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.effects.effect.shake = function( o, done ) {
|
||||
|
||||
var el = $( this ),
|
||||
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
|
||||
mode = $.effects.setMode( el, o.mode || "effect" ),
|
||||
direction = o.direction || "left",
|
||||
distance = o.distance || 20,
|
||||
times = o.times || 3,
|
||||
anims = times * 2 + 1,
|
||||
speed = Math.round(o.duration/anims),
|
||||
ref = (direction === "up" || direction === "down") ? "top" : "left",
|
||||
positiveMotion = (direction === "up" || direction === "left"),
|
||||
animation = {},
|
||||
animation1 = {},
|
||||
animation2 = {},
|
||||
i,
|
||||
|
||||
// we will need to re-assemble the queue to stack our animations in place
|
||||
queue = el.queue(),
|
||||
queuelen = queue.length;
|
||||
|
||||
$.effects.save( el, props );
|
||||
el.show();
|
||||
$.effects.createWrapper( el );
|
||||
|
||||
// Animation
|
||||
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
|
||||
animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
|
||||
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
|
||||
|
||||
// Animate
|
||||
el.animate( animation, speed, o.easing );
|
||||
|
||||
// Shakes
|
||||
for ( i = 1; i < times; i++ ) {
|
||||
el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
|
||||
}
|
||||
el
|
||||
.animate( animation1, speed, o.easing )
|
||||
.animate( animation, speed / 2, o.easing )
|
||||
.queue(function() {
|
||||
if ( mode === "hide" ) {
|
||||
el.hide();
|
||||
}
|
||||
$.effects.restore( el, props );
|
||||
$.effects.removeWrapper( el );
|
||||
done();
|
||||
});
|
||||
|
||||
// inject all the animations we just queued to be first in line (after "inprogress")
|
||||
if ( queuelen > 1) {
|
||||
queue.splice.apply( queue,
|
||||
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
||||
}
|
||||
el.dequeue();
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@@ -1031,133 +1031,3 @@ jQuery.cookie = function (key, value, options) {
|
||||
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
|
||||
};
|
||||
|
||||
// Sticky Plugin v1.0.0 for jQuery
|
||||
// =============
|
||||
// Author: Anthony Garand
|
||||
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
|
||||
// Improvements by Leonardo C. Daronco (daronco)
|
||||
// Created: 2/14/2011
|
||||
// Date: 2/12/2012
|
||||
// Website: http://labs.anthonygarand.com/sticky
|
||||
// Description: Makes an element on the page stick on the screen as you scroll
|
||||
// It will only set the 'top' and 'position' of your element, you
|
||||
// might need to adjust the width in some cases.
|
||||
|
||||
(function($) {
|
||||
var defaults = {
|
||||
topSpacing: 0,
|
||||
bottomSpacing: 0,
|
||||
className: 'is-sticky',
|
||||
wrapperClassName: 'sticky-wrapper',
|
||||
center: false,
|
||||
getWidthFrom: ''
|
||||
},
|
||||
$window = $(window),
|
||||
$document = $(document),
|
||||
sticked = [],
|
||||
windowHeight = $window.height(),
|
||||
scroller = function() {
|
||||
var scrollTop = $window.scrollTop(),
|
||||
documentHeight = $document.height(),
|
||||
dwh = documentHeight - windowHeight,
|
||||
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
|
||||
|
||||
for (var i = 0; i < sticked.length; i++) {
|
||||
var s = sticked[i],
|
||||
elementTop = s.stickyWrapper.offset().top,
|
||||
etse = elementTop - s.topSpacing - extra;
|
||||
|
||||
if (scrollTop <= etse) {
|
||||
if (s.currentTop !== null) {
|
||||
s.stickyElement
|
||||
.css('position', '')
|
||||
.css('top', '');
|
||||
s.stickyElement.parent().removeClass(s.className);
|
||||
s.currentTop = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var newTop = documentHeight - s.stickyElement.outerHeight()
|
||||
- s.topSpacing - s.bottomSpacing - scrollTop - extra;
|
||||
if (newTop < 0) {
|
||||
newTop = newTop + s.topSpacing;
|
||||
} else {
|
||||
newTop = s.topSpacing;
|
||||
}
|
||||
if (s.currentTop != newTop) {
|
||||
s.stickyElement
|
||||
.css('position', 'fixed')
|
||||
.css('top', newTop);
|
||||
|
||||
if (typeof s.getWidthFrom !== 'undefined') {
|
||||
s.stickyElement.css('width', $(s.getWidthFrom).width());
|
||||
}
|
||||
|
||||
s.stickyElement.parent().addClass(s.className);
|
||||
s.currentTop = newTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
resizer = function() {
|
||||
windowHeight = $window.height();
|
||||
},
|
||||
methods = {
|
||||
init: function(options) {
|
||||
var o = $.extend(defaults, options);
|
||||
return this.each(function() {
|
||||
var stickyElement = $(this);
|
||||
|
||||
var stickyId = stickyElement.attr('id');
|
||||
var wrapper = $('<div></div>')
|
||||
.attr('id', stickyId + '-sticky-wrapper')
|
||||
.addClass(o.wrapperClassName);
|
||||
stickyElement.wrapAll(wrapper);
|
||||
|
||||
if (o.center) {
|
||||
stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
|
||||
}
|
||||
|
||||
if (stickyElement.css("float") == "right") {
|
||||
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
|
||||
}
|
||||
|
||||
var stickyWrapper = stickyElement.parent();
|
||||
// stickyWrapper.css('height', stickyElement.outerHeight());
|
||||
sticked.push({
|
||||
topSpacing: o.topSpacing,
|
||||
bottomSpacing: o.bottomSpacing,
|
||||
stickyElement: stickyElement,
|
||||
currentTop: null,
|
||||
stickyWrapper: stickyWrapper,
|
||||
className: o.className,
|
||||
getWidthFrom: o.getWidthFrom
|
||||
});
|
||||
});
|
||||
},
|
||||
update: scroller
|
||||
};
|
||||
|
||||
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener('scroll', scroller, false);
|
||||
window.addEventListener('resize', resizer, false);
|
||||
} else if (window.attachEvent) {
|
||||
window.attachEvent('onscroll', scroller);
|
||||
window.attachEvent('onresize', resizer);
|
||||
}
|
||||
|
||||
$.fn.sticky = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || !method ) {
|
||||
return methods.init.apply( this, arguments );
|
||||
} else {
|
||||
$.error('Method ' + method + ' does not exist on jQuery.sticky');
|
||||
}
|
||||
};
|
||||
$(function() {
|
||||
setTimeout(scroller, 0);
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user