Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (27 sloc) 0.824 kb
# Scrolls the window to element at the specified speed:
# $('element').scrollTo(speed)
$.fn.scrollTo = (speed) ->
target = this
container = 'html,body'
offset = $(target).offset().top - 30
$(container).animate({scrollTop: offset}, speed or 1000)
this
$ ->
$('#demo').click ->
$('#demo-box').toggle()
if $('#demo-box:visible').length > 0
$('#demo').scrollTo(1)
window.location.hash = '#demo'
else
window.location.hash = ''
false
$('#demo').click() if window.location.hash is "#demo"
$('.run').click ->
try
template = $('.template').val()
json = $.parseJSON $('.json').val()
html = Mustache.to_html(template, json).replace(/^\s*/mg, '')
catch e
html = e.toString()
$('.html').text(html).scrollTo(1)
Highlight.highlightDocument()
Jump to Line
Something went wrong with that request. Please try again.