Instantly share code, notes, and snippets.

View Indent Fixed Menu
var h_hght = 105; // высота шапки
var h_mrg = 0; // отступ когда шапка уже не видна
$(function(){
$(window).scroll(function(){
var top = $(this).scrollTop();
var elem = $('.top_nav');
if (top+h_mrg < h_hght) {
elem.css('top', (h_hght-top));
} else {
elem.css('top', h_mrg);
View JQuery Alert Box
$(".btn_alert").click(function(){
var whitebg = document.getElementById("white_background");
var dlg = document.getElementById("dlgbox");
whitebg.style.display = "none";
dlg.style.display = "none";
setTimeout(function() {
$.fancybox.close();
}, 1000);
});
View Pop Form FancyBox
<div class="hidden">
<form id="callback" class="pop_form">
<input type="text" name="name" placeholder="имя" required><br>
<input type="text" name="phone" placeholder="телефон" required><br>
<button class="button">Заказать</button>
</form>
</div>
.hidden{
display: none;
View Waypoint
// Cache selectors
var lastId,
topMenu = $(".main_mnu"),
topMenuHeight = topMenu.outerHeight() + 15,
// All list items
menuItems = topMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function() {
var item = $($(this).attr("href"));
if (item.length) {
View Wordpress query_post
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
View Wordpress get category
<?php
$idObj = get_category_by_slug('charity');
$id = $idObj->term_id;
?>
<?php echo get_cat_name($id) ?>
View Toggle-mnu.js
$(".hamburger").click(function(){
$(this).toggleClass("is-active");
$(".main_mnu ul").slideToggle();
});
View Toggle-mnu.html
<div class="hamburg-inner">
<button class="hamburger hamburger--collapse">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
</div>
View Toggle-mnu.sass
.hamburger
padding: 16px 0
display: inline-block
cursor: pointer
transition-property: opacity, -webkit-filter
transition-property: opacity, filter
transition-property: opacity, filter, -webkit-filter
transition-duration: 0.15s
transition-timing-function: linear
font: inherit
View modulejavascript.js
var contactMe = (function() {
var init = function() {
_setUpListners();
};
var _setUpListners = function() {
};