Skip to content

Instantly share code, notes, and snippets.

View helielson's full-sized avatar

Helielson helielson

  • Indaband, Frontend Bahia
  • Salvador, Brazil
View GitHub Profile
@helielson
helielson / content.html
Created April 16, 2013 17:48
Centering in the Unknown
<div class="block" style="height: 300px;">
<div class="centered">
<h1>Some text</h1>
<p>But he stole up to us again, and suddenly clapping his hand on my shoulder, said&mdash;"Did ye see anything looking like men going towards that ship a while ago?"</p>
</div>
</div>
<div class="block" style="height: 200px;">
<div class="centered">
<h1>Some text</h1>
/*
* jQuery autoresize 0.1
* http://jusbrasil.com
* Copyright 2013
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* @author: [email protected]
*/
@helielson
helielson / appearing-filter.js
Last active December 12, 2015 03:59
jQuery filter to detect if a element or part of it is appearing in the window (viewport)
jQuery.expr[':'].appearing = function(elem) {
var $window = $(window),
windowViewTop = $window.scrollTop(),
windowViewBottom = windowViewTop + $window.height(),
elemTop = $(elem).offset().top,
elemBottom = elemTop + $(elem).height(),
isAppearingFully = ((elemTop >= windowViewTop) && (elemBottom <= windowViewBottom)),
isAppearingBottom = ((windowViewTop > elemTop) && (windowViewTop < elemBottom)),
isAppearingTop = ((windowViewBottom > elemTop) && (windowViewTop < elemBottom));
@helielson
helielson / responsive.css
Last active April 15, 2022 01:14
Boilerplate CSS Media Queries
* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@helielson
helielson / slider.html
Created December 2, 2012 15:05
Infinite slideshow js
<div class="slider">
<div class="slide-mask">
<ul class="slide-images" style="<!-- imagesAmount * slideWidth -->">
<a href="http://path/to/link">
<li style="background-image: url(http://path/to/image);"></li>
</a>
<a href="http://path/to/link">
<li style="background-image: url(http://path/to/image);"></li>
</a>
</ul>