Skip to content

Instantly share code, notes, and snippets.

View shehabkhan013's full-sized avatar
💭
Wordpress Theme Developer

A. M. Shehab Khan shehabkhan013

💭
Wordpress Theme Developer
View GitHub Profile
@shehabkhan013
shehabkhan013 / menu-active.js
Created January 23, 2018 07:53
menu-active > li addClass
li.current_page_item
--------------------------
$(".header-menu li a").each(function () {
if ($(this).attr("href") == pgurl || $(this).attr("href") == pgurl + '.html') {
$(this).parent().addClass("current_page_item");
$(this).parents('li').addClass("current_page_item");
}
});
@shehabkhan013
shehabkhan013 / Ajax-Contact-Form-php.js
Last active January 22, 2018 19:05
Ajax Contact Form Resource
PHP Code:
--------------
<?php
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$name = strip_tags(trim($_POST["name"]));
$name = str_replace(array("\r","\n"),array(" "," "),$name);
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
@shehabkhan013
shehabkhan013 / search.css
Last active January 18, 2018 19:36
Search Click Functions
/* Search area-Start */
.search-area {
text-align: center;
}
.search-icon {
border: 1px solid transparent;
color: #333;
display: inline-block;
font-size: 17px;
@shehabkhan013
shehabkhan013 / instagram-active.js
Last active December 30, 2017 10:37
Instagram active
var feed = new Instafeed({
get: 'user',
userId: 6665768655,
accessToken: '6665768655.1677ed0.313e6c96807c45d8900b4f680650dee5',
target: 'Instafeed',
resolution: 'thumbnail',
limit: 6,
template: '<li><a href="{{link}}" target="_new"><img src="{{image}}" /></a></li>',
});
feed.run();
$('.menu a[href*="#"]:not([href="#"])').on("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);
return false;
}
function scrollToTop($topClass){
var top_0 = {scrollTop:0};
var topClass = $($topClass);
topClass.on("click" , function(e){
$("html,body").animate(top_0,1000);
return false;
});
$(window).scroll(function(){
if($(this).scrollTop() > 400) {
topClass.fadeIn(500);
function responsiveMenu($width){
if ($(window).width() < $width) {
$("#menu").hide();
}else {
$("#menu").show();
}
$('.menu-button').on('click' , function(){
$("#menu").slideToggle(500);
return false;
//Nav menu active class change
var lastId
, topMenu = $(".menu")
, topMenuHeight = topMenu.outerHeight() + 15
,menuItems = topMenu.find("a")
,scrollItems = menuItems.map(function () {
var item = $($(this).attr("href"));
if (item.length) {
return item;
}
// Check the initial Poistion of the Sticky Header
var stickyHeaderTop = $('#stickyheader').offset().top;
$(window).scroll(function(){
if( $(window).scrollTop() > stickyHeaderTop ) {
$('#stickyheader').css({position: 'fixed', top: '0px'});
$('#stickyalias').css('display', 'block');
$('#stickyheader').addClass('fix-top');
} else {
$('#stickyheader').css({position: 'static', top: '0px'});
$('#stickyalias').css('display', 'none');
$('.count').each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).text()
}, {
duration: 4000,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});