Skip to content

Instantly share code, notes, and snippets.

View Takaya213's full-sized avatar
🎯
Focusing

Nicole Lambon Takaya213

🎯
Focusing
View GitHub Profile
@Takaya213
Takaya213 / scroll-up-bar.css
Last active August 29, 2015 14:01
Scroll Up Bar
body {
padding-top: 40px;
}
header {
background: #f5b335;
height: 40px;
position: fixed;
top: 0;
transition: top 0.2s ease-in-out;
@Takaya213
Takaya213 / show-hide-password.js
Created May 2, 2013 07:53
A jQuery method to show and hide passwords in forms.
$(document).ready(function(){
$('.showpassword').each(function (index, input){
var $input = $(input);
$("#passwordshow").click(function () {
var change = $(this).is(":checked") ? "text" : "password";
var text = $(this).is(":checked") ? "Hide Password" : "Show Password";
var rep = $("<input type='" + change + "' />")
.attr("id", $input.attr("id"))
.attr("name", $input.attr("name"))
.attr('class', $input.attr('class'))
@Takaya213
Takaya213 / scroll-effect.js
Created May 2, 2013 07:54
An easy way to create a scroll effect on pages from one anchor to another.
$(document).ready(function(){
$('a').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
return false;
});
});
@Takaya213
Takaya213 / watermark.js
Created May 2, 2013 07:57
A watermark effect for input boxes.
(function($) {
$.fn.watermark = function() {
return this.each(function() {
var obj = $(this);
var initialText = obj.val();
obj.focus(function() {
if (obj.val() === initialText)
obj.val("");
@Takaya213
Takaya213 / fixed-header.js
Last active December 17, 2015 19:39
Fixed the header/nav to the top of the page in a slightly different style via a class.
function scrolled_menu() {
if ($(window).scrollTop() > $('header').height()) {
$('header').addClass('fixed_type');
$('html').addClass('fixed_type_html');
} else {
$('header').removeClass('fixed_type');
$('html').removeClass('fixed_type_html');
}
}
@Takaya213
Takaya213 / equal-height.js
Created July 5, 2013 08:37
Make elements have the same height.
$.fn.equalizeHeights = function() {
var maxHeight = this.map(function(i,e) {
return $(e).height();
}).get();
return this.height( Math.max.apply(this, maxHeight) );
};
$('.equal').equalizeHeights();
@Takaya213
Takaya213 / clone_increment.html
Last active September 22, 2016 10:15
Clone a section of form code and increment the name/is of the inputs.
<div class="input_fields_wrap">
<div>
<input type="text" name="fields[contact][new1][fields][contactName]" /><br />
<input type="text" name="fields[contact][new1][fields][contactSurname]" /><br />
<input type="text" name="fields[contact][new1][fields][contactEmail]" />
</div>
<button class="add_field_button">Add More Fields</button>
</div>
@Takaya213
Takaya213 / clearfix-mixin.scss
Created October 1, 2015 06:58
Clearfix with Sass
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
.wrap {
@include clearfix;
@Takaya213
Takaya213 / MetaTags.html
Last active October 6, 2016 08:06
Meta Tags
<!-- UX Compatible Meta Tag -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<!-- Viewport Meta Tag -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Favicon Meta Tag -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/images/general/favicon.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/images/general/favicon.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/images/general/favicon.png" />
@Takaya213
Takaya213 / vertical-align.css
Created October 1, 2015 06:56
Vertical Align Anything
.parent-element {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.element {
position: relative;
top: 50%;
transform: translateY(-50%);