Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .centered(ng-app='myApp', ng-controller='MainCtrl')
  .centered-title ngTouch
  .propagator(ng-click='propagated()')
    span Propagated@
    .result.
      &nbsp;{{propagatedValue}}&nbsp;
    br
    button.btn(ng-click='clicked()') click
    br
    button.btn(ng-click='clickedShift()', ng-class="{'btn-offset' : shift}") clickshift
    br
    input.input(ng-click='clicked()', value="click meh")
    br
    br
    input.input(value="I haz no ng-click")
    br
    br
    span Clicked@
    .result.
      &nbsp;{{test}}&nbsp;

script(src='//code.jquery.com/jquery-2.0.3.min.js')
script(src='//code.angularjs.org/1.2.9/angular.min.js')
script(src='//code.angularjs.org/1.2.9/angular-touch.min.js')
              
            
!

CSS

              
                @import compass

@import url(https://fonts.googleapis.com/css?family=Duru+Sans)

body
  @user-select: none
  
  background: #394240
  font-family: 'Duru Sans', sans-serif
  text-align: center
  min-height: 450px
    
.centered
  +transform(translateX(-50%) translateY(-50%))
  
  position: absolute
  top: 50%
  left: 50%
  margin-top: 50px
    
.centered-title
  color: white
  font-size: 36px
  left: 3px
  position: absolute
  top: -36px
  
@mixin gimme-color($color)
  +box-shadow(0 3px 0 darken($color, 20%))
    
  background-color: $color
  
.propagator
  +gimme-color(#F06B50)
  
  border-radius: 6px
  padding: 20px
  
  &.ng-click-active
    +gimme-color(lighten(#F06B50, 10%))
    
.btn
  +box-sizing(border-box)
  +gimme-color(#FAF4B1)
    
  border: none
  border-radius: 3px
  cursor: pointer
  display: block
  font-size: 1.3em
  letter-spacing: 3px
  line-height: 1.8em
  padding: 0 10px
  text-transform: uppercase
  width: 100%
  
  &.ng-click-active
    +box-shadow(0 0 0 transparent)
    +transform(translateY(3px))
      
  &.btn-offset
    +transform(translateX(130%))
      
    &.ng-click-active
      +transform(translateX(130%) translateY(3px))
    
.result
  +gimme-color(white)
  
  border-radius: 3px
  line-height: 1.5em
  margin-top: 3px
  text-align: center
  
.input
  font-size: 1.3em
              
            
!

JS

              
                "use strict"

# An attempt at a fast ng-click for mobile browsers. The ngTouch module currently, does not remove the 300ms delay on mobile browsers if jQuery is included.

# The red area is a test if the events propagate properly through the DOM, it's there to catch the click or touch bubbling from the buttons and input below. When succesful, it will update the 'Propagated@" field.

# The clickshift button is there to check if we fail to catch ghost clicks properly. When touchend fires, it will be shifted 130% to the right for 2 seconds.

app = angular.module("myApp", ['ngTouch'])

app.controller "MainCtrl", ($scope, $timeout) ->
  $scope.propagated = ->
    $scope.propagatedValue = new Date().getTime()
    
  $scope.clicked = ->
    $scope.test = new Date().getTime()
    
  $scope.clickedShift = ->
    $scope.clicked()
    $scope.shift = true
    $timeout ->
      $scope.shift = false
    , 2000
    
app.directive "ngClick", ->
  restrict: "A"
  link: (scope, element, attr) ->
    touchBroken = false
    touchMoveCounter = 0
      
    applyAttribute = ->
      if !touchBroken
        # if $(element).is("input")
        #  element.focus()
        scope.$apply(attr['ngClick'])

    element.on 'touchend', (event) ->
      touchMoveCounter = 0
      event.preventDefault()
      applyAttribute()
      
      touchBroken = false
      touchMoveCounter = 0
        
    element.on 'touchmove', (event) ->
      return if touchBroken

      if !touchBroken
        touchMoveCounter++
        
      if touchMoveCounter > 2
        touchBroken = true
              
            
!
999px

Console