This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//input[name=name] only letters and spaces | |
$('input[name=name]').on('keydown', function(e) { | |
var key = event.keyCode; | |
return ((key >= 65 && key <= 90) || key === 8 || key === 32); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You can use document.getElementById('divId').className.split(/\s+/); to get you an array of class names. | |
//Then you can iterate and find the one you want. | |
var classList = document.getElementById('divId').className.split(/\s+/); | |
for (var i = 0; i < classList.length; i++) { | |
if (classList[i] === 'someClass') { | |
//do something | |
} | |
} | |
//jQuery does not really help you here... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var txt = "#div-name-1234-characteristic:561613213213"; | |
var numb = txt.match(/\d/g); | |
numb = numb.join(""); | |
alert (numb); | |
//result | |
1234561613213213 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($('.swiper-container').length > 0) { //some-slider-wrap-in | |
let swiperInstances = []; | |
$(".swiper-container").each(function(index, element){ //some-slider-wrap-in | |
const $this = $(this); | |
$this.addClass("instance-" + index); //instance need to be unique (ex: some-slider) | |
$this.parent().find(".swiper-pagination").addClass("pagination-" + index); | |
$this.parent().find(".swiper-button-prev").addClass("prev-" + index); //prev must be unique (ex: some-slider-prev) | |
$this.parent().find(".swiper-button-next").addClass("next-" + index); //next must be unique (ex: some-slider-next) | |
swiperInstances[index] = new Swiper(".instance-" + index, { //instance need to be unique (ex: some-slider) | |
// your settings ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"sass": "node-sass --source-map=true -w ./src/scss/style.scss -o ./dist/server/public/css/ --style compressed", | |
"prefix": "postcss -u autoprefixer --autoprefixer.browsers 'ie 10, android 4, opera 12.1, > 2%' -r ./dist/server/public/css/style.css", | |
"babel": "babel ./src/ -d ./dist/ -w", | |
"webpack": "webpack -w", | |
"server": "nodemon ./dist/server/server.js", | |
"sync": "browser-sync start --directory --server --files '*.css, *.js, *.html'", | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.header { | |
position: fixed; | |
-webkit-transform: translateZ(0); //use this FIX | |
backface-visibility: hidden; //or this FIX | |
} | |
//BOTH works |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="countdown-block"> | |
<div class="text">Don't miss it! Token sale ends in:</div> | |
<div class="countdown-wrap"> | |
<div class="countdown" id="countdown"> | |
<span id="days">30</span> | |
<span id="hours">21</span> | |
<span id="minutes">15</span> | |
<span id="seconds">00</span> | |
</div> | |
<div class="countdown-text"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function numberWithSpaces(nr) { | |
return nr.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nFormatter(num, digits) { | |
const si = [ | |
{ value: 1, symbol: "" }, | |
{ value: 1E3, symbol: "k" }, | |
{ value: 1E6, symbol: "M" }, | |
{ value: 1E9, symbol: "G" }, | |
{ value: 1E12, symbol: "T" }, | |
{ value: 1E15, symbol: "P" }, | |
{ value: 1E18, symbol: "E" } | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !\.(?:css|js|jpe?g|gif|png|svg|otf|ttf|woff|woff2|eot|mp4|mpeg|avi)$ [NC] | |
RewriteRule . /index.html [L] | |
#OR | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / |