Skip to content

Instantly share code, notes, and snippets.

@sayhicoelho
Last active July 5, 2018 05:05
Show Gist options
  • Save sayhicoelho/7fdf7115b52e0daa8c8b3ab156cfac80 to your computer and use it in GitHub Desktop.
Save sayhicoelho/7fdf7115b52e0daa8c8b3ab156cfac80 to your computer and use it in GitHub Desktop.
Configura bibliotecas Javascript mais utilizadas.
$(function () {
// FastClick
// https://github.com/ftlabs/fastclick
FastClick.attach(document.body);
// Stellar
// http://markdalgleish.com/projects/stellar.js/
// Utilize o atributo data-stellar-background-ratio="0.5" no elemento que desejar o efeito parallax
$.stellar({
horizontalScrolling: false,
verticalOffset: 40
});
// Select2
// https://select2.github.io/
$("select").select2();
// DataTables
// https://datatables.net/
$('table.datatables').DataTable();
// iCheck
// http://icheck.fronteed.com/
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
// jQuery Mask Plugin
// https://igorescobar.github.io/jQuery-Mask-Plugin/
var SPMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
}, spOptions = {
onKeyPress: function (val, e, field, options) {
field.mask(SPMaskBehavior.apply({}, arguments), options);
}
};
$('#celular').mask(SPMaskBehavior, spOptions);
$('#telefone').mask('(00) 0000-0000');
$('#cep').mask('00000-000');
$('#cpf').mask('000.000.000-00');
$('#cnpj').mask('00.000.000/0000-00');
$('input.percent').mask('##0%', { reverse: true });
$('input.money').mask("#.##0,00", { reverse: true });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment