Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:acidb/mobiscroll into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasz committed Jul 28, 2016
2 parents b0f7a81 + 32d8bee commit f0d410d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 52 deletions.
15 changes: 5 additions & 10 deletions css/mobiscroll.frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@

/* Bubble mode */

.mbsc-fr-bubble .mbsc-fr-popup {
margin: 20px 0;
}

.mbsc-fr-bubble .mbsc-fr-arr-w {
position: absolute;
z-index: 1;
Expand All @@ -129,17 +125,16 @@
}

.mbsc-fr-bubble-top .mbsc-fr-arr-w {
bottom: -36px;
top: 100%;
}

.mbsc-fr-bubble-bottom .mbsc-fr-arr-w {
top: -36px;
bottom: 100%;
}

.mbsc-fr-bubble .mbsc-fr-arr-i {
margin: 0 30px;
position: relative;
height: 36px;
}

.mbsc-fr-bubble .mbsc-fr-arr {
Expand All @@ -148,7 +143,7 @@

.mbsc-fr-arr {
display: none;
position: absolute;
position: relative;
left: 0;
width: 0;
height: 0;
Expand All @@ -158,11 +153,11 @@
}

.mbsc-fr-bubble-bottom .mbsc-fr-arr {
top: 0;
bottom: 0;
}

.mbsc-fr-bubble-top .mbsc-fr-arr {
bottom: 0;
top: 0;
}

.mbsc-fr-hdn {
Expand Down
4 changes: 2 additions & 2 deletions js/i18n/mobiscroll.i18n.he.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Hebrew
(function () {
mobiscroll.i18n['he'] = {
mobiscroll.i18n.he = {
// Core
rtl: true, // Right to left mode
setText: 'שמירה',
Expand Down Expand Up @@ -58,4 +58,4 @@
backText: 'חזור',
undoText: 'ביטול פעולה'
};
})();
})();
26 changes: 4 additions & 22 deletions js/mobiscroll.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ var mobiscroll = mobiscroll || {};
val: function (value) {
if (typeof value === 'undefined') {
if (this.length && this[0].multiple) {
return $.map(this.find('option:checked'), function (v) { return v.value; });
return $.map(this.find('option:checked'), function (v) {
return v.value;
});
}
return this[0] ? this[0].value : undefined;
}
}

if (this.length && this[0].multiple) {
$.each(this[0].options, function () {
Expand Down Expand Up @@ -485,26 +487,6 @@ var mobiscroll = mobiscroll || {};
return this.length > 0 ? parseFloat(this.css('height')) : null;
}
},
outerWidth: function (includeMargins) {
if (this.length > 0) {
if (includeMargins) {
var styles = this.styles();
return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left'));
} else {
return this[0].offsetWidth;
}
}
},
outerHeight: function (includeMargins) {
if (this.length > 0) {
if (includeMargins) {
var styles = this.styles();
return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom'));
} else {
return this[0].offsetHeight;
}
}
},
innerWidth: function () {
var elm = this;
if (this.length > 0) {
Expand Down
22 changes: 13 additions & 9 deletions js/mobiscroll.frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
al, // anchor left
arr, // arrow
arrw, // arrow width
arrh, // arrow height
arrl, // arrow left
dh,
scroll,
Expand Down Expand Up @@ -261,16 +262,16 @@
if (!that._isFullScreen && /center|bubble/.test(s.display)) {
$wrapper.width('');
$('.mbsc-w-p', $markup).each(function () {
w = $(this).outerWidth(true);
w = this.offsetWidth;
totalw += w;
minw = (w > minw) ? w : minw;
});
w = totalw > nw ? minw : totalw;
$wrapper.width(w + 1).css('white-space', totalw > nw ? '' : 'nowrap');
}

modalWidth = $popup.outerWidth();
modalHeight = $popup.outerHeight(true);
modalWidth = $popup[0].offsetWidth;
modalHeight = $popup[0].offsetHeight;
scrollLock = modalHeight <= nh && modalWidth <= nw;

that.scrollLock = scrollLock;
Expand All @@ -293,22 +294,25 @@
at = Math.abs($ctx.offset().top - ap.top);
al = Math.abs($ctx.offset().left - ap.left);

aw = anchor[0].offsetWidth;
ah = anchor[0].offsetHeight;

arrw = arr[0].offsetWidth;
arrh = arr[0].offsetHeight;

// horizontal positioning
aw = anchor.outerWidth();
ah = anchor.outerHeight();
l = constrain(al - ($popup.outerWidth(true) - aw) / 2, sl + 3, sl + nw - modalWidth - 3);
l = constrain(al - (modalWidth - aw) / 2, sl + 3, sl + nw - modalWidth - 3);

// vertical positioning
t = at - modalHeight; // above the input
t = at - modalHeight - arrh / 2; // above the input
if ((t < st) || (at > st + nh)) { // if doesn't fit above or the input is out of the screen
$popup.removeClass('mbsc-fr-bubble-top').addClass('mbsc-fr-bubble-bottom');
t = at + ah; // below the input
t = at + ah + arrh / 2; // below the input
} else {
$popup.removeClass('mbsc-fr-bubble-bottom').addClass('mbsc-fr-bubble-top');
}

// Calculate Arrow position
arrw = arr.outerWidth();
arrl = constrain(al + aw / 2 - (l + (modalWidth - arrw) / 2), 0, arrw);

// Limit Arrow position
Expand Down
3 changes: 1 addition & 2 deletions js/mobiscroll.scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@
idx,
offset,
ret,
v,
isVisible = that._isVisible;

isValidating = true;
Expand Down Expand Up @@ -439,7 +438,7 @@
if (wheel.multiple) {
// Add selected styling to selected elements in case of multiselect
if (index === undefined) {
for (v in that._tempSelected[i]) {
for (var v in that._tempSelected[i]) {
wheel._$markup
.find('.mbsc-sc-itm[data-val="' + v + '"]')
.addClass(selectedClass)
Expand Down
7 changes: 0 additions & 7 deletions js/mobiscroll.scrollview.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,6 @@
});
}

//snap = s.snap ?
// (util.isNumeric(s.snap) ? s.snap :
// ((vertical ?
// (s.snap === true ? $elm.height() : $(s.snap, el).eq(0).outerHeight()) :
// (s.snap === true ? $elm.width() : $(s.snap, el).eq(0).outerWidth())) || 1))
// : 1;

snap = isNumeric(s.snap) ? s.snap : 1;
maxSnapScroll = s.snap ? s.maxSnapScroll : 0;
easing = s.easing;
Expand Down

0 comments on commit f0d410d

Please sign in to comment.