Skip to content

Commit

Permalink
v2.1.2
Browse files Browse the repository at this point in the history
- Corrige problema com links externos com id. Ex: index#footer;
- Resolve problema com imagens envolvidas em links (menu);
- Adiciona exceção para options em .gt-form-inline;
- Determina z-index 9 para o menu, evitando sobreposição;
- Adiciona input[type=number] à estilização do .gt-form;
- Melhora estilização de .vertical-list > *.
  • Loading branch information
JP Rodrigues authored May 3, 2017
2 parents e125c0d + 08dc99f commit 98b32ae
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 55 deletions.
94 changes: 48 additions & 46 deletions build/js/gainTime.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
function makeA(a) {
a.addEventListener("click", function(e) {
var d = a.href.split("/");
var file = d[d.length - 1];
f = file.split("#")[1];
var file = d[d.length - 1].split("#");
var h = document.location.toString().split("/")
var here = h[h.length - 1].split("#");
f = file[1];

if (f != undefined) {
if (f != undefined && (here[0] === file[0])) {
e.preventDefault();
f = f.replace(/\#/g,"");
var target = document.getElementById(f);
animate(document.scrollingElement || document.documentElement, "scrollTop", "", currentYPosition(), target.offsetTop - 60, 500, true);
var el = document.scrollingElement || document.documentElement;
var to = document.getElementById(f).offsetTop - 60;
smoothScroll(el, to, 600);
}
})
}

function currentYPosition() {
// Firefox, Chrome, Opera, Safari
if (self.pageYOffset) return self.pageYOffset;
// Internet Explorer 6 - standards mode
if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
// Internet Explorer 6, 7 and 8
if (document.body.scrollTop) return document.body.scrollTop;
return 0;
}

function elmYPositioneID(id) {
var elm = document.getElementById(id);
var y = elm.offsetTop;
var node = elm;
while (node.offsetParent && node.offsetParent != document.body) {
node = node.offsetParent;
y += node.offsetTop;
}
return y;
}

function animate(elem, style, unit, from, to, time, prop) {
var distance = to > from ? to - from : from - to;
if ( distance <= 30) { return false; }
if (!elem) { return; }
var start = new Date().getTime(),
timer = setInterval(function () {
var step = Math.min(1, (new Date().getTime() - start) / time);
if (prop) {
elem[style] = (from + step * (to - from))+unit;
} else {
elem.style[style] = (from + step * (to - from))+unit;
var smoothScroll = function(element, target, duration) {
target = Math.round(target);
duration = Math.round(duration);

if (duration < 0) return Promise.reject("bad duration");
if (duration === 0) {
element.scrollTop = target;
return Promise.resolve();
}
var start_time = Date.now();
var end_time = start_time + duration;
var start_top = element.scrollTop;
var distance = target - start_top;

// based on http://en.wikipedia.org/wiki/Smoothstep
var smoothStep = function(start, end, point) {
if(point <= start) { return 0; }
if(point >= end) { return 1; }
var x = (point - start) / (end - start); // interpolation
return x*x*(3 - 2*x);
}

return new Promise(function(resolve, reject) {
var previous_top = element.scrollTop;
var scrollFrame = function() {
var now = Date.now();
var point = smoothStep(start_time, end_time, now);
var frameTop = Math.round(start_top + (distance * point));
element.scrollTop = frameTop;
if(now >= end_time) {
resolve();
return;
}
if (step === 1) {
clearInterval(timer);
if(element.scrollTop === previous_top && element.scrollTop !== frameTop) {
resolve();
return;
}
}, 25);
if (prop) {
elem[style] = from+unit;
} else {
elem.style[style] = from+unit;
}
previous_top = element.scrollTop;
setTimeout(scrollFrame, 0);
}
setTimeout(scrollFrame, 0);
});
}

function menuToggle(a) {
Expand Down
11 changes: 3 additions & 8 deletions build/sass/components/_forms.sass
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ select
&[type=checkbox], &[type=radio]
@extend %checkers

.vertical-list
& > *
display: block
margin: 5px 0

%gt-form

small
Expand All @@ -47,7 +42,7 @@ select
input[type=checkbox], input[type=radio]
@extend %checkers

input[type=text], input[type=password], input[type=email], select, textarea
input[type=text], input[type=number], input[type=password], input[type=email], select, textarea
@extend %field

textarea
Expand All @@ -58,13 +53,13 @@ select

.gt-form
max-width: 500px
input[type=text], input[type=password], input[type=email], select, textarea, small
label, input[type=text], input[type=number], input[type=password], input[type=email], select, textarea, small
display: block
width: 100%

@media (min-width: 769px)
.gt-form-inline
*
*:not(option)
display: inline-block !important
vertical-align: middle !important
width: auto !important
Expand Down
5 changes: 5 additions & 0 deletions build/sass/helpers/_singles.sass
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
padding-top: 15px
padding-bottom: 15px

.vertical-list
& > *
display: block!important
margin: 5px 0

.content-align
display: block
margin: 15px 0
Expand Down
3 changes: 2 additions & 1 deletion build/sass/layouts/_header.sass
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
height: 60px
padding: 10px 5%
width: 100%
z-index: 9
+box-shadow (0px 0px 4px 0px rgba(50, 50, 50, 0.4))

& > img, nav, ul, li
& > img, & > a > img, nav, ul, li
height: 100%

%adjust-btn
Expand Down

0 comments on commit 98b32ae

Please sign in to comment.