Skip to content

Instantly share code, notes, and snippets.

View sagarjadhav's full-sized avatar

Sagar Jadhav sagarjadhav

  • rtCamp Inc
  • Pune
View GitHub Profile
/* select element styling */
jQuery('.rtp-select').each( function() {
var self = jQuery(this),
title = self.attr('title');
if( jQuery('option:selected', this).val() !== '' ) title = jQuery('option:selected', this).text();
self
.css({
'z-index': 10,
'opacity': 0,
@sagarjadhav
sagarjadhav / equal-height.js
Created September 24, 2013 12:01
jQuery Equal Height Elements
/* Equal Height */
jQuery('.elemWrapper').each(function(){
var max = Math.max.apply(Math, jQuery(this).find('.elem').map(function() { return jQuery(this).height(); }));
jQuery(this).addClass('fixed-height').find('.elem').height(max);
});
@sagarjadhav
sagarjadhav / smooth-scroll.js
Created September 13, 2013 06:14
jQuery smooth scroll animation
/* Smooth Scroll */
jQuery('.rtp-back-to-top').click( function() {
jQuery('html, body').animate({
scrollTop: jQuery( jQuery(this).attr('href') ).offset().top
}, 1000);
return false;
});
@sagarjadhav
sagarjadhav / hide-div-on-outside-click.js
Last active December 22, 2015 19:49
jQuery to hide a DIV when the user clicks outside of it.
$(document).mouseup(function (e) {
var container = $("YOUR CONTAINER SELECTOR");
/* if the target of the click isn't the container */
/* Nor a descendant of the container */
if ( !container.is(e.target) && container.has(e.target).length === 0) {
container.hide();
}
});
@sagarjadhav
sagarjadhav / drag-tab-slider.css
Last active December 22, 2015 10:48
Drag-able Tab Slider
/* Dragable Slider */
.slider-wrapper { background: #DDD; width: 540px; }
.handle-containment { height: 34px; position: relative; }
.handle { position: relative; display: inline-block; height: 34px; width: 180px; top: -34px; padding-bottom: 1px; background: rgba(0, 0, 0, 0); font-weight: bold; color: #FFF; text-decoration: none; text-align: center; line-height: 34px; text-indent: -9999px; }
.nav-areas { margin: 0; position: relative; }
.nav-areas li { float: left; height: 34px; list-style: none; text-align: center; width: 180px; }
.nav-areas a { color: white; font-size: 0.8125em; line-height: 34px; text-decoration: none; display: block; cursor: pointer; position: relative; z-index: 20; }
@sagarjadhav
sagarjadhav / remove-wp-comments.php
Created July 10, 2013 08:52
Remove commment support from post, pages, admin menu and admin bar.
<?php
/* Remove Comments Tab from admin menu */
function rtp_remove_admin_menus() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'rtp_remove_admin_menus');
/* Remove commment support from post and pages */
@sagarjadhav
sagarjadhav / post-attachment.php
Created June 20, 2013 10:36
Get WP Post Attachments
<?php
/* Get Children Images */
function rtp_get_post_attachments( $parent_id ) {
$args = array(
'post_type' => 'attachment',
'numberposts' => 3,
'post_status' => null,
'post_parent' => $parent_id,
'exclude' => get_post_thumbnail_id($parent_id)
@sagarjadhav
sagarjadhav / sticky-scroll-sidebar-within-content.js
Last active December 18, 2015 16:29
The Sticky Scroll Sidebar plugin is designed to allow an element to stick to the top of the screen as page scrolls down, but without moving outside of the parent container.
/**
* Plugin for sticky scroll sidebar within content.
*/
// Utility : Object.create dosen't work all browsers.
if ( typeof Object.create !== 'function' ) {
Object.create = function( obj ) {
function F() {};
F.prototype = obj;
return new F();
@sagarjadhav
sagarjadhav / jquery-tab-plugin.js
Last active December 16, 2015 00:09
jQuery Tabs
/* Utility : Object.create dosen't work all browsers. */
if ( typeof Object.create !== 'function' ) {
Object.create = function( obj ) {
function F() {};
F.prototype = obj;
return new F();
};
}
(function( $, window, document, undefined ) {
@sagarjadhav
sagarjadhav / plugin.js
Last active December 15, 2015 23:59
jQuery Plugin Initial Code
/* Utility : Object.create dosen't work all browsers. */
if ( typeof Object.create !== 'function' ) {
Object.create = function( obj ) {
function F() {};
F.prototype = obj;
return new F();
};
}
(function( $, window, document, undefined ) {