Skip to content

Instantly share code, notes, and snippets.

контейнер для непропорционального контента
.main-block__video {
position: relative;
width: 100%;
height: 0;
padding-bottom: calc(100% / 1.78); // Just proportions of video 16:9 (You can use 100% and You shoud divide width on 1.78 (40% / 1.78 = 22.47%)
}
}
@aligator28
aligator28 / Image instead of Video (ease page load)
Last active March 1, 2023 10:33
Image instead of Video (ease page load)
index.html
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title></title>
<style>
.page {
@aligator28
aligator28 / Tooltip triangle (подсказка с треугольничком внизу на CSS)
Last active February 28, 2023 17:40
CSS Tooltip triangle (подсказка с треугольничком внизу на CSS)
Sure, here's an example of CSS code that can display a tooltip block without using any images:
.tooltip {
position: relative;
display: inline-block;
cursor: pointer;
}
.tooltip::before {
content: "";
html {
font-size: 62.5%;
/* 62.5% of the base size of 16px = 10px./
}
body {
@aligator28
aligator28 / admin-redirect.php
Created February 11, 2017 08:56 — forked from kharissulistiyo/admin-redirect.php
Admin Page Redirection After WordPress Theme Activated
/**
* WordPress snippet
* Admin page redirection
* Put this inside theme setup function
*/
global $pagenow;
if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) {
@aligator28
aligator28 / jquery-scroll-bottom.js
Created January 9, 2017 22:41 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@aligator28
aligator28 / js image preloading
Created October 31, 2016 16:35
Images preloading javascript (предзагрузка изображений js)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rotate Image</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="row" id="img1"></div>
@aligator28
aligator28 / Add categories to custom post type Wordpress (добавить категории к пользовательскому типу поста)
Last active October 20, 2016 13:05
Добавить категории к кастом пост тайпу (categories for custom post type) Wordpress
// add these to functions.php or in Sage to sage/lib/some-file-name.php (do not forget to add in functions.php to load this file)
<?php
//
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if( is_category() ) {
$post_type = get_query_var('post_type');
if($post_type)
@aligator28
aligator28 / smooth scroll - плавный скролл по якорям
Created October 9, 2016 08:14
Плавный скролл по якорям (Smooth scroll)
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
@aligator28
aligator28 / Dynamic javascript loading
Created October 5, 2016 11:20
Dynamic javascript loading, Динамическая загрузка js
// var script = document.createElement('script');
// script.src = 'http://cdn.jsdelivr.net/jquery.validation/1.15.1/jquery.validate.min.js';
// script.onload = function () {
// };
// document.head.appendChild(script); //or something of the likes