Skip to content

Instantly share code, notes, and snippets.

View morethenlife's full-sized avatar
🏠
Working from home

Roman Kopka morethenlife

🏠
Working from home
View GitHub Profile
@morethenlife
morethenlife / WordPress query_posts
Last active August 29, 2015 14:16
WordPress query_posts
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php global $more; $more = 0; ?>
<?php the_title(); ?>
<?php the_content('Далее'); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
@morethenlife
morethenlife / подключение стилей bootstrap через bootstrap
Last active August 29, 2015 14:17
подключение стилей bootstrap через bootstrap
<?php echo esc_url( get_template_directory_uri() ); ?>
function primary_scripts_styles()
{
wp_enqueue_style('primary-style', get_stylesheet_uri());
wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/bootstrap/css/bootstrap.min.css', false, null);
wp_enqueue_script('bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array('jquery'), null);
}
@morethenlife
morethenlife / jQuery Page Preload
Created March 16, 2015 20:43
jQuery Page Preload
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
@morethenlife
morethenlife / jquery заметки
Last active August 16, 2018 16:31
jquery заметки
$(document).ready(function)(){
//вызов функции после полной прогрузки DOM дерева
};
var $j = jQuery.noConflict(); //используеться в том случае если подключенны стороние библиотеки
//вывод нужных элементов на страницу
document .images
document .links
document .forms
@morethenlife
morethenlife / липкий слайдер
Created June 2, 2015 10:21
липкий слайдер
js:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var HeaderTop = $('#header').offset().top;
$(window).scroll(function(){
if( $(window).scrollTop() > HeaderTop ) {
$('#header').css({position: 'fixed', top: '0px'});
} else {
@morethenlife
morethenlife / Липкая навигация
Created September 15, 2015 14:48
Липкая навигация
$(document).ready(function(){
var $menu = $("#nav_top");
$(window).scroll(function(){
if ( $(this).scrollTop() > 200 && $menu.hasClass("default") ){
$menu.fadeOut('fast',function(){
$(this).removeClass("default")
.addClass("fixed transbg")
@morethenlife
morethenlife / resize jquery
Created December 13, 2015 22:48
resize jquery
(function($) {
var $window = $(window),
$html = $('.header_s');
$window.resize(function resize(){
if ($window.width() < 480) {
return $html.addClass('mobile_bg');
}
$html.removeClass('mobile');
@morethenlife
morethenlife / fixed menu
Created January 21, 2016 10:15
fixed menu
// Фикмированная шапка при скролле
$("#header").removeClass("nav_header--clone");
$(window).scroll(function(){
if ($(this).scrollTop() > 300) {
$("#header").addClass("nav_header--clone").fadeIn('slow');
} else {
$("#header").removeClass("nav_header--clone").fadeIn('slow');
};
});
@morethenlife
morethenlife / data atribite
Created January 21, 2016 12:00
data atribite
$('.event').on('click', function() {
var event_number = $(this).data('event');
$('.wrapper_popup_services[data-article="' + event_number + '"]').addClass('popup_close_open').removeClass('popup_close');
$('.popup_servises').addClass('servises_delay');
});
@morethenlife
morethenlife / redirect mobile-version
Created January 23, 2016 11:44
redirect mobile-version
/// REDIRECT TO m.truvile.ru
(function(window) {
var width = -1;
//var height = -1;
if (window.screen.width) {
width = parseInt(window.screen.width);
}