Skip to content

Instantly share code, notes, and snippets.

View shulard's full-sized avatar
🌍
Working from anywhere…

Stéphane HULARD shulard

🌍
Working from anywhere…
View GitHub Profile
@shulard
shulard / swipe.js
Created June 10, 2015 14:04
Just a swipe detection in javascript
var $el = $('... selector');
$el.bind({
touchstart: function(event) {
$el.data('start.x',event.originalEvent.touches[0].pageX);
},
touchmove: function(event) {
$el.data('delta', event.originalEvent.touches[0].pageX - $el.data('start.x'));
},
touchend: function(event) {
if( Math.abs($el.data('delta')) > 100 ) {

Keybase proof

I hereby claim:

  • I am shulard on github.
  • I am shulard (https://keybase.io/shulard) on keybase.
  • I have a public key whose fingerprint is 9401 AF5A 33D4 D2CD D720 0997 1A0B 1D84 38A7 4EAC

To claim this, I am signing this object:

@shulard
shulard / .gitignore
Last active August 29, 2015 14:10
24 jours de web: Comment bien versionner mon site WordPress avec Git et Github
#Installation Wordpress
/wp-cms/*
#Contenus non versionnés
/wp-content/uploads/
/wp-content/plugins/
#Configuration
/wp-config.php
@shulard
shulard / Article.md
Created December 11, 2012 16:31 — forked from Warry/Article.md
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows: