Skip to content

Instantly share code, notes, and snippets.

@molochnyk
molochnyk / Element Non
Created Aug 3, 2019
Element Non (display:none)
View Element Non
.elementHidden{
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
View gist:6dd8b8f7a7c27a6291c037775f0b4b9b
function sliceWords() {
let line = document.querySelectorAll('.secten_block_items_doc p');
function cutWords(str, max = 20) {
str.forEach((el) => {
if(el.textContent.length > max) {
let string = el.textContent.trim().split(' ').slice(0, max).join() + ' ...';
el.innerHTML = string;
}
})
return str
View ajax-javascript-form
<script>
$("form.form").submit(function () {
let th = $(this);
let inputNumber = th.find('input[name=tel]').val();
if(inputNumber.length < 17) return false;
th.find('button[type="submit"]').attr('disabled', 'true');
$.ajax({
View Button Top
HTML code
<div class="top" title="Наверх">
<i class="fa fa-angle-double-up"></i>
</div>
CSS(SCSS) code
.top{
position: fixed;
bottom: 25px;
right: -100px;
@molochnyk
molochnyk / jQuery Resize Height
Last active Apr 4, 2017
jQuery Resize Height
View jQuery Resize Height
$(document).ready(function() {
function heightDetect(){
$('.main_head').css('height', $(window).height());
};
heightDetect();
$(window).resize(function(){
heightDetect();
})
}); //endReady
You can’t perform that action at this time.