Skip to content

Instantly share code, notes, and snippets.

View OleksandrLz's full-sized avatar

Oleksandr Lazarenko OleksandrLz

View GitHub Profile
watch: {
$route () {
if (this.$route.name !== 'home') {
// document.getElementById('example').style.zIndex = '-999'
} else {
// document.getElementById('example').style.zIndex = '999'
}
}
},
// HTML (after form)
<div class="process">
<div class="loader">
<div class="sk-fading-circle">
<div class="sk-circle1 sk-circle"></div>
<div class="sk-circle2 sk-circle"></div>
<div class="sk-circle3 sk-circle"></div>
<div class="sk-circle4 sk-circle"></div>
<div class="sk-circle5 sk-circle"></div>
<div class="sk-circle6 sk-circle"></div>
// random sort arr
arr.sort(function(){
return Math.random() > 0.5;
})
// random number from ... to ...
function mtRandom(min, max){
let diff = max-min;
// e-mail
export default function validateEmail (email) {
const re = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
return re.test(email)
}
// name
export function nameContainsAlpha (value) {
font-family:
-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
@OleksandrLz
OleksandrLz / slowly-scroll
Created December 10, 2016 19:37
script for slowly transition between anchors
//.scrollto - class for tag "a"
// 1000 - time for slowly transition
jQuery(document).ready(function() {
jQuery("a.scrollto").click(function () {
elementClick = jQuery(this).attr("href")
destination = jQuery(elementClick).offset().top;
jQuery("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 1000);
return false;
});
});
@OleksandrLz
OleksandrLz / cut-text
Created December 10, 2016 09:54
cut long text
<!-- html code -->
<div class="news-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Facere nostrum neque quae aliquid magnam quibusdam nesciunt,
totam sit, autem quas accusamus
</div>
// js code
var size = 10,
newsContent= $('.news-content'),
newsText = newsContent.text();
@OleksandrLz
OleksandrLz / animation
Last active December 5, 2016 09:42
animation css (sass)
// resize - it's a name of @keyframes
h1
font-size: 48px
animation: resize 1s ease-in-out infinite
// change 'resize' - from 48px to 58px and back to 48px
@keyframes resize
0%
font-size: 48px
50%
font-size: 58px