Skip to content

Instantly share code, notes, and snippets.

@ricardozea
ricardozea / add-remove-class-to-labels.js
Last active April 26, 2023 01:31
jQuery: Add/remove a class to labels with checkboxes and radio buttons and style them
//Add/remove a class to labels with checkboxes and radio buttons and style them
$('label input[type=radio], label input[type=checkbox]').click(function() {
$('label:has(input:checked)').addClass('active');
$('label:has(input:not(:checked))').removeClass('active');
});
@ricardozea
ricardozea / ie67891011-css-hacks.txt
Last active February 2, 2023 15:17
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
@ricardozea
ricardozea / script.js
Last active January 4, 2023 02:13
Smooth scroll to top of page (Improved!)
window.scrollTo({top: 0, behavior: "smooth"});
@ricardozea
ricardozea / Smooth scroll to top of page.markdown
Last active October 28, 2022 08:44
Smooth scroll to top of page

Visit the new improved script here! Smooth scroll to top of page (Improved!)


Smooth scroll to top of page (Legacy!)

If you need a plain JavaScript function to add a smooth scrolling back to the top of the page, you can use this script.

  1. Add an id of "top" to the <body> tag. Like this: <body id="top">
  2. Add the onclick function to the link. Like this: <a href="#top" onclick="scrollToTop(); return false">Back to Top ↑</a>
@ricardozea
ricardozea / year.js
Last active March 3, 2021 01:34
UPDATE: Use this one instead: https://snippets.cacher.io/snippet/dcd110499b3150c77795 ~~Script for year so you don't have to type it or have old pages display past years.~~
/*
Script to display the year.
Edited by: Ricardo Zea
*/
var time=new Date();
var year=time.getYear();
if (year < 2000)
year = year + 1900;
document.write(" " + year + " ");
@ricardozea
ricardozea / aqua-style-buttons-mixin.scss
Last active June 23, 2020 11:58
SCSS: Aqua style buttons mixin
/* Aqua style buttons mixin
Demo on Codepen:
http://codepen.io/rzea/pen/CgIzG/
*/
//Variables
$solidColor: #000; // Change this color to anything you want, leave everything else as is
$gradientFilters: rgba(255,255,255,.2) 50%, rgba(255,255,255,0) 50.01%;
//Usage
@ricardozea
ricardozea / _reset.scss
Created March 27, 2014 14:57
CSS: Eric Meyer's Reset as a Sass partial
/* Eric Meyer's CSS Reset
http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
This is a Sass partial
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
@ricardozea
ricardozea / simple-tab-system-jquery.markdown
Last active April 11, 2019 20:49
The simplest Tab system ever using jQuery. It can be used with keyboard as well. SCSS for the CSS. Don't forget to include jQuery.

Simple Tab System (jQuery)

The simplest Tab system ever using jQuery. It can be used with keyboard as well. SCSS for the CSS. Don't forget to include jQuery.

See the Pen here by Ricardo Zea on CodePen.

License.

// Hardware cfg - Generated by QUAKE LIVE. Do not modify
unaliasall
seta zmq_rcon_password ""
seta zmq_stats_password ""
seta net_socksPassword ""
seta net_socksUsername ""
seta net_socksPort "1080"
seta net_socksServer ""
seta net_socksEnabled "0"
seta net_noudp "0"
@ricardozea
ricardozea / css
Last active March 21, 2019 22:14
After displaying a container on click, hide it by: clicking outside, clicking on the Close button or pressing ESC key. Demo here: http://jsfiddle.net/rzea/3p9n2vsb/2/
.flyout {
display: none;
width: 200px;
height: 200px;
margin: 1em;
padding: 20px;
position: relative;
background: #ccc;
}