Skip to content

Instantly share code, notes, and snippets.

View rokkohorosi's full-sized avatar

Hiroyoshi Fukubayashi rokkohorosi

View GitHub Profile
@rokkohorosi
rokkohorosi / gist:4490363
Created January 9, 2013 03:45
画面のスクロール位置を、Google Analyticsのイベントトラッキングに記録する。 記録したい要素のidを配列として関数に渡すと、その要素が画面に表示されたときに記録を残す。
$.extend({
attachScrollEventTracking: function(eventcategory, pagePartsIdList) {
var pageParts = {};
var windowHeight = $(window).height();
$.each(pagePartsIdList, function(key, pagePartsId){
//console.log(pagePartsId);
var target = $("#" + pagePartsId);
if (target.length > 0) {
pageParts[pagePartsId] = target.offset().top;
@rokkohorosi
rokkohorosi / gist:4282395
Created December 14, 2012 03:11
スマホで画像をランダムに移動させる。 使用例) ImageAnimation().initialize("honyy_bee", "/js/test/bee.png", $(window).width(), $(window).height()); ※HTMLのID、移動させる画像(上向きに指向性があるもの)、移動範囲の幅、移動範囲の高さ
(function () {
var offsetX = 0;
var offsetY = 0;
var offsetScroolY = 0;
var currentDeg = 0;
var currentX = 0;
var currentY = 0;
var dX = 0;
var dY = 0;
@rokkohorosi
rokkohorosi / gist:4282291
Created December 14, 2012 02:59
スマホの画面タップ時に要素をhoverさせる CSSは、a:hoverの代わりにa.hoverを使う aタグ以外の場合はclassにtapを指定するとCSSで:hoverの代わりに.hoverを使えるようになる
(function () {
var tapClass = "";
var hoverClass = "";
var Hover = window.Hover = function (ele) {
return new Hover.fn.init(ele);
};
Hover.fn = {
//Hover Instance
init : function (ele) {