Last active
August 29, 2015 14:01
-
-
Save EdConnell/e23ba5a9a776c58803c6 to your computer and use it in GitHub Desktop.
d3.js learning script to be modified for populating x,y values for evehelper rails app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#map{ | |
border: 1px solid black; | |
} | |
#systems { | |
display: inline-block; | |
vertical-align: text-top; | |
margin: -785px 0 0 10px; | |
height: 800px; | |
overflow: scroll; | |
} | |
td span { | |
float: right; | |
} | |
/* Tipsy CSS */ | |
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; } | |
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; } | |
/* Rounded corners */ | |
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } | |
/* Uncomment for shadow */ | |
/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/ | |
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; } | |
/* Rules to colour arrows */ | |
.tipsy-arrow-n { border-bottom-color: #000; } | |
.tipsy-arrow-s { border-top-color: #000; } | |
.tipsy-arrow-e { border-left-color: #000; } | |
.tipsy-arrow-w { border-right-color: #000; } | |
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; } | |
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} | |
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} | |
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | |
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | |
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } | |
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; } | |
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>D3 Learning</title> | |
<link rel="stylesheet" type="text/css" href="d3.css"> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script src="d3.js"></script> | |
<script src="tipsy.js"></script> | |
</head> | |
<body> | |
<svg id="map" width="1200" height="800"></svg> | |
<div id="systems"> | |
<form> | |
<table> | |
</table> | |
</form> | |
</div> | |
<div id="results"> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataset = [{"eve_id":"30000846","name":"E-OGL4","station":false,"jumps":41,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000847","name":"J-GAMP","station":true,"jumps":20,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000848","name":"M-OEE8","station":true,"jumps":123,"npc_kills":0,"ship_kills":12,"pod_kills":12},{"eve_id":"30000849","name":"V0DF-2","station":true,"jumps":13,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000850","name":"FY0W-N","station":true,"jumps":6,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000851","name":"MJI3-8","station":true,"jumps":4,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000852","name":"A-DDGY","station":false,"jumps":7,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000853","name":"F-RT6Q","station":false,"jumps":60,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000854","name":"B-S42H","station":false,"jumps":10,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000855","name":"NL6V-7","station":false,"jumps":8,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000856","name":"F-749O","station":false,"jumps":19,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000857","name":"0-YMBJ","station":false,"jumps":237,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000858","name":"UMI-KK","station":true,"jumps":247,"npc_kills":0,"ship_kills":2,"pod_kills":2},{"eve_id":"30000859","name":"GKP-YT","station":false,"jumps":8,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000860","name":"AW1-2I","station":false,"jumps":215,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000861","name":"15W-GC","station":true,"jumps":95,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000862","name":"N-FK87","station":false,"jumps":60,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000863","name":"C2X-M5","station":true,"jumps":86,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000864","name":"MSHD-4","station":true,"jumps":92,"npc_kills":0,"ship_kills":1,"pod_kills":1},{"eve_id":"30000865","name":"H-W9TY","station":true,"jumps":144,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000866","name":"PNDN-V","station":true,"jumps":64,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000867","name":"D7-ZAC","station":true,"jumps":308,"npc_kills":13,"ship_kills":0,"pod_kills":0},{"eve_id":"30000868","name":"SH1-6P","station":true,"jumps":33,"npc_kills":8,"ship_kills":0,"pod_kills":0},{"eve_id":"30000869","name":"TRKN-L","station":true,"jumps":12,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000870","name":"O-0ERG","station":true,"jumps":31,"npc_kills":38,"ship_kills":0,"pod_kills":0},{"eve_id":"30000871","name":"WH-JCA","station":true,"jumps":292,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000872","name":"Q-CAB2","station":true,"jumps":29,"npc_kills":152,"ship_kills":0,"pod_kills":0},{"eve_id":"30000873","name":"PBD-0G","station":true,"jumps":0,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000874","name":"L-1HKR","station":true,"jumps":8,"npc_kills":189,"ship_kills":0,"pod_kills":0},{"eve_id":"30000875","name":"9GI-FB","station":true,"jumps":12,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000876","name":"3G-LHB","station":false,"jumps":2,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000877","name":"DBT-GB","station":true,"jumps":4,"npc_kills":67,"ship_kills":0,"pod_kills":0},{"eve_id":"30000878","name":"U-W3WS","station":false,"jumps":1,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000879","name":"DL1C-E","station":false,"jumps":14,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000880","name":"YLS8-J","station":false,"jumps":8,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000881","name":"2ISU-Y","station":false,"jumps":1,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000882","name":"X-CFN6","station":true,"jumps":1,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000883","name":"9SL-K9","station":false,"jumps":1,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000884","name":"Y-PZHM","station":true,"jumps":1,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000885","name":"OY-UZ1","station":false,"jumps":5,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000886","name":"S8-NSQ","station":false,"jumps":3,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000887","name":"GIH-ZG","station":true,"jumps":9,"npc_kills":46,"ship_kills":0,"pod_kills":0},{"eve_id":"30000888","name":"V7-FB4","station":false,"jumps":4,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000889","name":"XD-TOV","station":true,"jumps":22,"npc_kills":84,"ship_kills":0,"pod_kills":0},{"eve_id":"30000890","name":"K-6SNI","station":true,"jumps":14,"npc_kills":26,"ship_kills":0,"pod_kills":0},{"eve_id":"30000891","name":"L-VXTK","station":true,"jumps":11,"npc_kills":40,"ship_kills":0,"pod_kills":0},{"eve_id":"30000892","name":"C8VC-S","station":false,"jumps":3,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000893","name":"W-UQA5","station":false,"jumps":2,"npc_kills":12,"ship_kills":0,"pod_kills":0},{"eve_id":"30000894","name":"W6VP-Y","station":true,"jumps":90,"npc_kills":39,"ship_kills":0,"pod_kills":0},{"eve_id":"30000895","name":"IMK-K1","station":true,"jumps":26,"npc_kills":9,"ship_kills":0,"pod_kills":0},{"eve_id":"30000896","name":"NJ4X-S","station":false,"jumps":27,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000897","name":"F-G7BO","station":true,"jumps":13,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000898","name":"2CG-5V","station":true,"jumps":46,"npc_kills":0,"ship_kills":0,"pod_kills":0},{"eve_id":"30000899","name":"QFF-O6","station":true,"jumps":83,"npc_kills":23,"ship_kills":1,"pod_kills":1}]; | |
var gatheredData | |
var height = 800 | |
var width = 1200 | |
var radius = 10 | |
var drag = d3.behavior.drag() | |
.on("drag", dragMove) | |
function dragMove(d) { | |
console.log("System: " + d.name +" X:" + d3.event.x + " Y: " + d3.event.y) | |
var newX = d3.mouse(this)[0] | |
var newY = Math.round(d3.mouse(this)[1]) | |
updateForm(d.name, newX, newY) | |
d3.select(this) | |
.attr("cx", d.x = Math.max(radius, Math.min(width - radius, d3.event.x))) | |
.attr("cy", d.y = Math.max(radius, Math.min(height - radius, d3.event.y))); | |
} | |
function systemForm() { | |
for(var i = 0; i < dataset.length; i++) { | |
var systemName = dataset[i].name | |
var systemFormHTML = "<tr><td><span>"+ systemName +":</span></td><td><input type=\"text\" name="+ systemName +" id="+ systemName +"></td></tr>" | |
$('form').append(systemFormHTML) | |
} | |
} | |
function updateForm(selector, x, y) { | |
$("input#" + selector).attr("value", x + "," + y) | |
} | |
function compileAndDisplayResults() { | |
resetData(); | |
$("input[type=text]").each(function() { | |
var solarSystemName = $(this).attr("id") | |
var x = $(this).attr("value").split(',')[0] | |
var y = $(this).attr("value").split(',')[1] | |
var system = {} | |
system[solarSystemName] = {} | |
system[solarSystemName].x = x | |
system[solarSystemName].y = y | |
gatheredData.push(system) | |
}) | |
displayData(); | |
} | |
function displayData() { | |
$("#results").html("<p>" + JSON.stringify(gatheredData) + "</p") | |
} | |
function resetData() { | |
gatheredData = [] | |
} | |
var button = "<tr><td> </td><td><button type=\"button\" id=\"serialize\">Serialize Data</button></td></tr>" | |
$(document).ready(function() { | |
systemForm() | |
$("form").append(button) | |
var map = d3.select("#map") | |
.append("svg") | |
.attr("height", height) | |
.attr("width", width) | |
var systems = map.selectAll("circle") | |
.data(dataset) | |
.enter() | |
.append("circle") | |
systems.attr("cx", function(data, index) { | |
return (index * 10) + 5; | |
}) | |
.attr("cy", function(data, index) { | |
return (index * 10) + 5; | |
}) | |
.attr("r", radius) | |
.attr('fill', 'orange') | |
.attr('stroke', 'yellow') | |
.attr('stroke-width', '1px') | |
.attr('class', 'solar-system') | |
.text(function(data) { | |
return data.name | |
}) | |
.call(drag) | |
$('.solar-system').tipsy({ | |
gravity: 'sw', | |
html: true, | |
// trigger: 'manual', | |
title: function() { | |
var d = this.__data__; | |
return 'System: ' + d.name; | |
} | |
}); | |
button = $("#serialize") | |
button.on("click", compileAndDisplayResults) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tipsy, facebook style tooltips for jquery | |
// version 1.0.0a | |
// (c) 2008-2010 jason frame [[email protected]] | |
// released under the MIT license | |
(function($) { | |
function maybeCall(thing, ctx) { | |
return (typeof thing == 'function') ? (thing.call(ctx)) : thing; | |
} | |
function Tipsy(element, options) { | |
this.$element = $(element); | |
this.options = options; | |
this.enabled = true; | |
this.fixTitle(); | |
} | |
Tipsy.prototype = { | |
show: function() { | |
var title = this.getTitle(); | |
if (title && this.enabled) { | |
var $tip = this.tip(); | |
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); | |
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity | |
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body); | |
var pos = $.extend({}, this.$element.offset(), { | |
width: this.$element[0].offsetWidth || 0, | |
height: this.$element[0].offsetHeight || 0 | |
}); | |
if (typeof this.$element[0].nearestViewportElement == 'object') { | |
// SVG | |
var el = this.$element[0]; | |
var rect = el.getBoundingClientRect(); | |
pos.width = rect.width; | |
pos.height = rect.height; | |
} | |
var actualWidth = $tip[0].offsetWidth, | |
actualHeight = $tip[0].offsetHeight, | |
gravity = maybeCall(this.options.gravity, this.$element[0]); | |
var tp; | |
switch (gravity.charAt(0)) { | |
case 'n': | |
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; | |
break; | |
case 's': | |
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; | |
break; | |
case 'e': | |
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}; | |
break; | |
case 'w': | |
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}; | |
break; | |
} | |
if (gravity.length == 2) { | |
if (gravity.charAt(1) == 'w') { | |
tp.left = pos.left + pos.width / 2 - 15; | |
} else { | |
tp.left = pos.left + pos.width / 2 - actualWidth + 15; | |
} | |
} | |
$tip.css(tp).addClass('tipsy-' + gravity); | |
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0); | |
if (this.options.className) { | |
$tip.addClass(maybeCall(this.options.className, this.$element[0])); | |
} | |
if (this.options.fade) { | |
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity}); | |
} else { | |
$tip.css({visibility: 'visible', opacity: this.options.opacity}); | |
} | |
var t = this; | |
var set_hovered = function(set_hover){ | |
return function(){ | |
t.$tip.stop(); | |
t.tipHovered = set_hover; | |
if (!set_hover){ | |
if (t.options.delayOut === 0) { | |
t.hide(); | |
} else { | |
setTimeout(function() { | |
if (t.hoverState == 'out') t.hide(); }, t.options.delayOut); | |
} | |
} | |
}; | |
}; | |
$tip.hover(set_hovered(true), set_hovered(false)); | |
} | |
}, | |
hide: function() { | |
if (this.options.fade) { | |
this.tip().stop().fadeOut(function() { $(this).remove(); }); | |
} else { | |
this.tip().remove(); | |
} | |
}, | |
fixTitle: function() { | |
var $e = this.$element; | |
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') { | |
$e.attr('original-title', $e.attr('title') || '').removeAttr('title'); | |
} | |
if (typeof $e.context.nearestViewportElement == 'object'){ | |
if ($e.children('title').length){ | |
$e.append('<original-title>' + ($e.children('title').text() || '') + '</original-title>') | |
.children('title').remove(); | |
} | |
} | |
}, | |
getTitle: function() { | |
var title, $e = this.$element, o = this.options; | |
this.fixTitle(); | |
if (typeof o.title == 'string') { | |
var title_name = o.title == 'title' ? 'original-title' : o.title; | |
if ($e.children(title_name).length){ | |
title = $e.children(title_name).html(); | |
} else{ | |
title = $e.attr(title_name); | |
} | |
} else if (typeof o.title == 'function') { | |
title = o.title.call($e[0]); | |
} | |
title = ('' + title).replace(/(^\s*|\s*$)/, ""); | |
return title || o.fallback; | |
}, | |
tip: function() { | |
if (!this.$tip) { | |
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'); | |
} | |
return this.$tip; | |
}, | |
validate: function() { | |
if (!this.$element[0].parentNode) { | |
this.hide(); | |
this.$element = null; | |
this.options = null; | |
} | |
}, | |
enable: function() { this.enabled = true; }, | |
disable: function() { this.enabled = false; }, | |
toggleEnabled: function() { this.enabled = !this.enabled; } | |
}; | |
$.fn.tipsy = function(options) { | |
if (options === true) { | |
return this.data('tipsy'); | |
} else if (typeof options == 'string') { | |
var tipsy = this.data('tipsy'); | |
if (tipsy) tipsy[options](); | |
return this; | |
} | |
options = $.extend({}, $.fn.tipsy.defaults, options); | |
if (options.hoverlock && options.delayOut === 0) { | |
options.delayOut = 100; | |
} | |
function get(ele) { | |
var tipsy = $.data(ele, 'tipsy'); | |
if (!tipsy) { | |
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options)); | |
$.data(ele, 'tipsy', tipsy); | |
} | |
return tipsy; | |
} | |
function enter() { | |
var tipsy = get(this); | |
tipsy.hoverState = 'in'; | |
if (options.delayIn === 0) { | |
tipsy.show(); | |
} else { | |
tipsy.fixTitle(); | |
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); | |
} | |
} | |
function leave() { | |
var tipsy = get(this); | |
tipsy.hoverState = 'out'; | |
if (options.delayOut === 0) { | |
tipsy.hide(); | |
} else { | |
var to = function() { | |
if (!tipsy.tipHovered || !options.hoverlock){ | |
if (tipsy.hoverState == 'out') tipsy.hide(); | |
} | |
}; | |
setTimeout(to, options.delayOut); | |
} | |
} | |
if (options.trigger != 'manual') { | |
var binder = options.live ? 'live' : 'bind', | |
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', | |
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; | |
this[binder](eventIn, enter)[binder](eventOut, leave); | |
} | |
return this; | |
}; | |
$.fn.tipsy.defaults = { | |
className: null, | |
delayIn: 0, | |
delayOut: 0, | |
fade: false, | |
fallback: '', | |
gravity: 'n', | |
html: false, | |
live: false, | |
offset: 0, | |
opacity: 0.8, | |
title: 'title', | |
trigger: 'hover', | |
hoverlock: false | |
}; | |
// Overwrite this method to provide options on a per-element basis. | |
// For example, you could store the gravity in a 'tipsy-gravity' attribute: | |
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' }); | |
// (remember - do not modify 'options' in place!) | |
$.fn.tipsy.elementOptions = function(ele, options) { | |
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options; | |
}; | |
$.fn.tipsy.autoNS = function() { | |
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n'; | |
}; | |
$.fn.tipsy.autoWE = function() { | |
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w'; | |
}; | |
/** | |
* yields a closure of the supplied parameters, producing a function that takes | |
* no arguments and is suitable for use as an autogravity function like so: | |
* | |
* @param margin (int) - distance from the viewable region edge that an | |
* element should be before setting its tooltip's gravity to be away | |
* from that edge. | |
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer | |
* if there are no viewable region edges effecting the tooltip's | |
* gravity. It will try to vary from this minimally, for example, | |
* if 'sw' is preferred and an element is near the right viewable | |
* region edge, but not the top edge, it will set the gravity for | |
* that element's tooltip to be 'se', preserving the southern | |
* component. | |
*/ | |
$.fn.tipsy.autoBounds = function(margin, prefer) { | |
return function() { | |
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)}, | |
boundTop = $(document).scrollTop() + margin, | |
boundLeft = $(document).scrollLeft() + margin, | |
$this = $(this); | |
if ($this.offset().top < boundTop) dir.ns = 'n'; | |
if ($this.offset().left < boundLeft) dir.ew = 'w'; | |
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e'; | |
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's'; | |
return dir.ns + (dir.ew ? dir.ew : ''); | |
}; | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment