Skip to content

Instantly share code, notes, and snippets.

View chiotis's full-sized avatar

Christos Chiotis chiotis

View GitHub Profile
@chiotis
chiotis / clickable_div.html
Created June 20, 2013 14:32
Make entire div clickable
<div class="myBox">
blah blah blah.
<a href="http://google.com">link</a>
</div>
@chiotis
chiotis / Facebook like image preloader.js
Created June 20, 2013 11:34
Facebook like image preloader
var nextimage = "/images/some-image.jpg";
$(document).ready(function(){
window.setTimeout(function(){
var img = $("<img>").attr("src", nextimage).load(function(){
//all done
});
}, 100);
});
@chiotis
chiotis / Equalize heights of div elements.js
Created June 20, 2013 10:58
Equalize heights of div elements
var maxHeight = 0;
$("div").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div").height(maxHeight);
@chiotis
chiotis / smooth_scrolling.js
Created June 20, 2013 10:55
Smooth scrolling to #anchor On your site footer, it is very useful to provide a quick way for your visitors to scroll back to the top of the page. Here is a simple way to smooth scroll to a #anchor of your choice.
// HTML:
// <h1 id="anchor">Lorem Ipsum</h1>
// <p><a href="#anchor" class="topLink">Back to Top</a></p>
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
@chiotis
chiotis / query.php
Created June 7, 2013 11:50
Wordpress Query
<?php
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
.cbp-af-header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: #f6f6f6;
z-index: 10000;
height: 230px;
overflow: hidden;
-webkit-transition: height 0.3s;