updated Uikit v2
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
(function(addon) {
|
||||
|
||||
var component;
|
||||
|
||||
if (window.UIkit) {
|
||||
component = addon(UIkit);
|
||||
if (window.UIkit2) {
|
||||
component = addon(UIkit2);
|
||||
}
|
||||
|
||||
if (typeof define == "function" && define.amd) {
|
||||
define("uikit-sticky", ["uikit"], function(){
|
||||
return component || addon(UIkit);
|
||||
if (typeof define == 'function' && define.amd) {
|
||||
define('uikit-sticky', ['uikit'], function(){
|
||||
return component || addon(UIkit2);
|
||||
});
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
clsactive : 'uk-active',
|
||||
clsinactive : '',
|
||||
getWidthFrom : '',
|
||||
showup : false,
|
||||
showup : false,
|
||||
boundary : false,
|
||||
media : false,
|
||||
target : false,
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
for (var i = 0; i < sticked.length; i++) {
|
||||
sticked[i].reset(true);
|
||||
//sticked[i].self.computeWrapper();
|
||||
sticked[i].self.computeWrapper();
|
||||
}
|
||||
|
||||
checkscrollposition();
|
||||
@ -65,11 +65,11 @@
|
||||
|
||||
setTimeout(function(){
|
||||
|
||||
UI.$("[data-uk-sticky]", context).each(function(){
|
||||
UI.$('[data-uk-sticky]', context).each(function(){
|
||||
|
||||
var $ele = UI.$(this);
|
||||
|
||||
if(!$ele.data("sticky")) {
|
||||
if (!$ele.data('sticky')) {
|
||||
UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
|
||||
}
|
||||
});
|
||||
@ -85,6 +85,12 @@
|
||||
|
||||
this.wrapper = this.element.wrap('<div class="uk-sticky-placeholder"></div>').parent();
|
||||
this.computeWrapper();
|
||||
this.wrapper.css({
|
||||
'margin-top' : this.element.css('margin-top'),
|
||||
'margin-bottom' : this.element.css('margin-bottom'),
|
||||
'margin-left' : this.element.css('margin-left'),
|
||||
'margin-right' : this.element.css('margin-right')
|
||||
})
|
||||
this.element.css('margin', 0);
|
||||
|
||||
if (boundary) {
|
||||
@ -140,13 +146,14 @@
|
||||
this.calcTop();
|
||||
|
||||
var finalize = function() {
|
||||
this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
|
||||
this.element.css({position:'', top:'', width:'', left:'', margin:'0'});
|
||||
this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
|
||||
this.element.addClass(this.options.clsinactive);
|
||||
this.element.trigger('inactive.uk.sticky');
|
||||
|
||||
this.currentTop = null;
|
||||
this.animate = false;
|
||||
|
||||
}.bind(this);
|
||||
|
||||
|
||||
@ -233,9 +240,8 @@
|
||||
computeWrapper: function() {
|
||||
|
||||
this.wrapper.css({
|
||||
'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
|
||||
'float' : this.element.css('float') != 'none' ? this.element.css('float') : '',
|
||||
'margin' : this.element.css('margin')
|
||||
'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
|
||||
'float' : this.element.css('float') != 'none' ? this.element.css('float') : ''
|
||||
});
|
||||
|
||||
if (this.element.css('position') == 'fixed') {
|
||||
@ -263,7 +269,7 @@
|
||||
|
||||
sticky = stickies[i];
|
||||
|
||||
if (!sticky.element.is(":visible") || sticky.animate) {
|
||||
if (!sticky.element.is(':visible') || sticky.animate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -290,7 +296,7 @@
|
||||
if (sticky.boundtoparent) {
|
||||
containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
|
||||
} else {
|
||||
containerBottom = documentHeight - bTop - parseInt(sticky.boundary.css('margin-top'));
|
||||
containerBottom = documentHeight - bTop;
|
||||
}
|
||||
|
||||
newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
|
||||
@ -300,7 +306,7 @@
|
||||
if (sticky.currentTop != newTop) {
|
||||
|
||||
sticky.element.css({
|
||||
position : "fixed",
|
||||
position : 'fixed',
|
||||
top : newTop,
|
||||
width : sticky.getWidthFrom.length ? sticky.getWidthFrom.width() : sticky.element.width()
|
||||
});
|
||||
|
Reference in New Issue
Block a user