Sha256: 54e208a3e8cd6b2868b19056d6e81474ac0eab042a08654d342dd720ba726360
Contents?: true
Size: 894 Bytes
Versions: 4
Compression:
Stored size: 894 Bytes
Contents
## nice labeled inputs labelHander = (input) -> label = input.closest('label') window.setTimeout (-> hasValue = if input.val().length > 0 then true else false if hasValue label.addClass "has-value" else label.removeClass "has-value" return ), 10 return $ -> if $("label.wrapping").length > 0 $("label.wrapping input, label.wrapping select").each -> labelHander( $(@) ) $("body").on "focus", "label.wrapping input, label.wrapping select", -> inpt = $(@) inpt.closest('label').addClass "has-focus" labelHander inpt $("body").on "keydown", "label.wrapping input", -> labelHander( $(@) ) $("body").on "change", "label.wrapping select", -> labelHander( $(@) ) $("body").on "blur", "label.wrapping input, label.wrapping select", -> inpt = $(@) inpt.closest('label').removeClass "has-focus" labelHander inpt
Version data entries
4 entries across 4 versions & 1 rubygems