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
/*! | |
* Simple jQuery Equal Heights | |
* | |
* Copyright (c) 2013 Matt Banks | |
* Dual licensed under the MIT and GPL licenses. | |
* Uses the same license as jQuery, see: | |
* http://docs.jquery.com/License | |
* | |
* @version 1.5.1 | |
*/ |
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
document.querySelectorAll('a[href^="#"]').forEach(function (el) { | |
el.onclick = function (e) { | |
e.preventDefault(); | |
var hash = this.getAttribute('href'); | |
var target = document.querySelector(hash); | |
var headerOffset = 100; | |
var elementPosition = target.offsetTop; | |
var offsetPosition = elementPosition - headerOffset; | |
window.scrollTo({ | |
top: offsetPosition, |
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() { | |
$('.hover').bind('touchstart touchend', function(e) { | |
e.preventDefault(); | |
$(this).toggleClass('hover-effect'); | |
}); | |
}); | |
In english: | |
when you start or end a touch, turn the class hover-effect on or off. | |
Then, in your HTML, add a class hover to anything you want this to work with. In your CSS, replace any instance of: |
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
//span around last word | |
$('.sentence').each(function(){ | |
var self = $(this); | |
self.html(self.html().replace(/(\S+)\s*$/, '<span>$1</span>')); | |
}); | |
//span around first word | |
$('.sentence').each(function(){ | |
var self = $(this); | |
self.html(self.html().replace(/^(\S+)/, '<span>$1</span>')); |
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
//add to SVG images class | |
<img src="img/logo.svg" alt="alt" class="img-svg"> | |
//Replace all SVG images with inline SVG | |
$('img.img-svg').each(function(){ | |
var $img = $(this); | |
var imgClass = $img.attr('class'); | |
var imgURL = $img.attr('src'); | |
$.get(imgURL, function(data) { |
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
//In Template | |
<?php | |
$options = get_option('sample_theme_options'); | |
echo $options['phone1']; | |
?> | |
//in functions.php | |
require_once ( get_stylesheet_directory() . '/theme-options.php' ); | |
//theme-options.php file: |
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
//My gulpfile based on htmlacademy | |
package.json | |
{ | |
"name": "project", | |
"version": "1.0.0", | |
"private": true, | |
"description": "", | |
"author": "Anton Litvinenko", | |
"devDependencies": { |
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 dowidth(){ | |
var width = $('body').width(); | |
if(width >= 1200) { | |
$('body').removeClass('large medium small x-small mobile'); | |
$('body').addClass('large'); | |
} | |
if(width < 1200 & width >= 992) { | |
$('body').removeClass('large medium small x-small mobile'); |