examples/touch/hammer.js
function toggleDefaultBehavior(element, css_props, toggle) {
    if(!css_props || !element || !element.style) {
      return;
    }

    // with css properties for modern browsers
    Utils.each(['webkit', 'moz', 'Moz', 'ms', 'o', ''], function setStyle(vendor) {
      Utils.each(css_props, function(value, prop) {
          // vender prefix at the property
          if(vendor) {
            prop = vendor + prop.substring(0, 1).toUpperCase() + prop.substring(1);
          }
          // set the style
          if(prop in element.style) {
            element.style[prop] = !toggle && value;
          }
      });
    });

    var false_fn = function(){ return false; };

    // also the disable onselectstart
    if(css_props.userSelect == 'none') {
      element.onselectstart = !toggle && false_fn;
    }
    // and disable ondragstart
    if(css_props.userDrag == 'none') {
      element.ondragstart = !toggle && false_fn;
    }
  }
function toggleDefaultBehavior(element, css_props, toggle) {
    if(!css_props || !element || !element.style) {
      return;
    }

    // with css properties for modern browsers
    Utils.each(['webkit', 'moz', 'Moz', 'ms', 'o', ''], function setStyle(vendor) {
      Utils.each(css_props, function(value, prop) {
          // vender prefix at the property
          if(vendor) {
            prop = vendor + prop.substring(0, 1).toUpperCase() + prop.substring(1);
          }
          // set the style
          if(prop in element.style) {
            element.style[prop] = !toggle && value;
          }
      });
    });

    var false_fn = function(){ return false; };

    // also the disable onselectstart
    if(css_props.userSelect == 'none') {
      element.onselectstart = !toggle && false_fn;
    }
    // and disable ondragstart
    if(css_props.userDrag == 'none') {
      element.ondragstart = !toggle && false_fn;
    }
  }
function toggleDefaultBehavior ( element , css_props , toggle ) { if ( ! css_props || ! element || ! element . style ) { return ; } // with css properties for modern browsers Utils . each ( [ 'webkit' , 'moz' , 'Moz' , 'ms' , 'o' , '' ] , function setStyle ( vendor ) { Utils . each ( css_props , function ( value , prop ) { // vender prefix at the property if ( vendor ) { prop = vendor + prop . substring ( 0 , 1 ) . toUpperCase ( ) + prop . substring ( 1 ) ; } // set the style if ( prop in element . style ) { element . style [ prop ] = ! toggle && value ; } } ) ; } ) ; var false_fn = function ( ) { return false ; } ; // also the disable onselectstart if ( css_props . userSelect == 'none' ) { element . onselectstart = ! toggle && false_fn ; } // and disable ondragstart if ( css_props . userDrag == 'none' ) { element . ondragstart = ! toggle && false_fn ; } }
toggle browser default behavior with css props
@param   {HtmlElement}   element
@param   {Object}        css_props
@param   {Boolean}       toggle
toggle browser default behavior with css props