Skip to content

Instantly share code, notes, and snippets.

@slavapas
slavapas / show-hide dropdown menu on hover-mouseout using jquery
Created March 29, 2017 13:10
show-hide dropdown menu on hover-mouseout using jquery
variant 1
------------
$(document).ready(function () {
$("#moretab").mouseenter(function(){
$("#categories").show();
});
$("#categories, #moretab").mouseleave(function(){
$("#categories").hide();
@slavapas
slavapas / Hide Div When Clicked Outside It
Created March 29, 2017 13:14
Hide Div When Clicked Outside It
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Vanilla Javascript DropDown Menu Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="menu-dropdown">Menu &#9660;</div>
@slavapas
slavapas / AJAX contact form 29.03.2017
Created March 29, 2017 15:07
AJAX contact form 29.03.2017
HTML
index.html
-------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AJAX Contact Form Demo</title>
<link rel="stylesheet" href="style.css">
@slavapas
slavapas / Ajax loading image gallery WordPress
Created March 1, 2018 06:36 — forked from azizultex/Ajax loading image gallery WordPress
Ajax loading image gallery WordPress ( coded for oliveorange.com )
@slavapas
slavapas / toogle classes between buttons
Last active February 15, 2019 14:02
Change classes on click
HTML
<button class="btn clr2">1</button>
<button class="btn clr2">2</button>
<button class="btn clr2">3</button>
<button class="btn clr2">4</button>
<button class="btn clr2">5</button>
<button class="btn clr2">6</button>
CSS
.clr{
@slavapas
slavapas / Close dropdowns by clicking outside of them with jQuery.js
Last active February 15, 2019 13:54
Close fropdown by clicking outside of menu jQuery
$(document).ready( function(){
$('#trigger').click( function(event){
event.stopPropagation();
$('#drop').toggle();
});
// this is the most important part
$(document).click( function(){
$('#drop').hide();
@slavapas
slavapas / zoom slider.html
Last active February 15, 2019 14:00
Zoom Slider
//HTML
<div class="slider">
<img src="https://source.unsplash.com/random" alt="" />
<img src="https://source.unsplash.com/category/nature" alt="" />
<img src="https://source.unsplash.com/category/food" alt="" />
<img src="https://source.unsplash.com/category/people" alt="" />
</div>
//CSS
@slavapas
slavapas / register_post_type.php
Created February 18, 2019 19:19
Register Post Type #Wordpress #Post Type
/**
* Register a custom post type called "book".
*
* @see get_post_type_labels() for label keys.
*/
function intensiv_custom_post_type_gallery() {
$labels = array(
'name' => _x( 'Galleries', 'Post type general name', textdomain' ),
'singular_name' => _x( 'Gallery', 'Post type singular name', 'textdomain' ),
);
@slavapas
slavapas / reset.css
Created February 18, 2019 20:28
reset.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
@slavapas
slavapas / php_security.php
Last active February 20, 2019 17:25
wordpress - prevents public user to directly access your .php files through URL
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?