ManifestWebDesign / angular-gridster

An implementation of gridster-like widgets for Angular JS
http://manifestwebdesign.github.io/angular-gridster/
MIT License
966 stars 395 forks source link

Documentation: Add class 'gridster-no-drag' on element to disable draggable. #483

Open natee opened 7 years ago

natee commented 7 years ago

angular-gridster allows us to disable draggable when click some elements, but there were no documents about how to use it.

  1. Add a class 'gridster-no-drag'
    // only works if you have jQuery
    if ($target.closest && $target.closest('.gridster-no-drag').length) {
        return false;
    }
  1. Add a directive
    .directive('gridsterNoDrag', function() {
    return {
        restrict: 'A',
        link: function(scope, $element) {
            $element.addClass('gridster-no-drag');
        }
    };
    })