Skip to content

Commit

Permalink
fix #47
Browse files Browse the repository at this point in the history
jquery was still present for function detection and browser to finish
later
  • Loading branch information
darul75 committed Dec 31, 2014
1 parent e01ae9d commit 9dbd758
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-slider",
"version": "2.0.7",
"version": "2.0.8",
"author": {
"name": "Julien Valéry",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion dist/css/ng-slider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/ng-slider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ng-slider",
"description": "AngularJS directive slider control.",
"version": "2.0.7",
"version": "2.0.8",
"author": {
"name": "Julien Valéry",
"email": "[email protected]"
Expand Down
17 changes: 11 additions & 6 deletions src/core/model/draggable.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,24 @@
if( this.is.drag ){
this.is.drag = false;

var browser = utils.browser();

if( this.outer && this.outer.get(0) ) {

if( $.browser.mozilla ){
if( browser === 'mozilla' ){
this.outer.css({ overflow: "hidden" });
} else {
this.outer.css({ overflow: "visible" });
}

if( $.browser.msie && $.browser.version == '6.0' ){
this.outer.css({ height: "100%" });
} else {
this.outer.css({ height: "auto" });
}
// TODO finish browser detection and this case, remove following line
this.outer.css({ height: "auto" });
// if( browser === 'ie' && $.browser.version == '6.0' ){
// this.outer.css({ height: "100%" });
// } else {
// this.outer.css({ height: "auto" });
// }

}

this.onmouseup( evt );
Expand Down
4 changes: 2 additions & 2 deletions src/core/model/slider.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

this.settings.interval = this.settings.to-this.settings.from;

if( this.settings.calculate && $.isFunction( this.settings.calculate ) )
if( this.settings.calculate && angular.isFunction( this.settings.calculate ) )
this.nice = this.settings.calculate;

if( this.settings.onstatechange && $.isFunction( this.settings.onstatechange ) )
if( this.settings.onstatechange && angular.isFunction( this.settings.onstatechange ) )
this.onstatechange = this.settings.onstatechange;

this.is = { init: false };
Expand Down
15 changes: 13 additions & 2 deletions src/core/utils/utils.factory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function(angular){
'use strict';

angular.module('ngSlider').factory('utils', function() {
angular.module('ngSlider').factory('utils', ['$window', function(win) {
return {
offset: function(elm) {
// try {return elm.offset();} catch(e) {}
Expand All @@ -14,9 +14,20 @@
_x = rawDom.getBoundingClientRect().left + scrollX;
_y = rawDom.getBoundingClientRect().top + scrollY;
return { left: _x, top:_y };
},
browser: function() {
// TODO finish browser detection and this case
var userAgent = win.navigator.userAgent;
var browsers = {mozilla: /mozilla/i, chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i, ie: /internet explorer/i};
for(var key in browsers) {
if (browsers[key].test(userAgent)) {
return key;
}
}
return 'unknown';
}
};
});
}]);
})(angular);


Expand Down
27 changes: 27 additions & 0 deletions src/ng-slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
</div>
</br>
</br>
<div>
<input ng-model="data.quote.coverages.coverageA" type="text" id="{{id}}" slider options="coverageASliderOptions" ng-disabled="disabled" />
</br>
</br>
<div>
Current value is: {{data.quote.coverages.coverageA}}
</div>
</br>
</br>
<div>
<input ng-model="value2" type="text" id="mySlider3" slider options="options" />
</div>
Expand Down Expand Up @@ -75,6 +84,24 @@
$scope.value4 = "999;1700";
$scope.value5 = 20;
$scope.value6 = "10;53";
$scope.data = {
quote: {
coverages: {
coverageA: 20000
}
}
};

$scope.defaultAmount=190000;

$scope.coverageASliderOptions = {
from: $scope.defaultAmount,
to: $scope.defaultAmount+ ($scope.defaultAmount* 0.20),
step: 500,
calculate: function(value) {
return $filter('currency')(value, '$', 0);
}
};

$scope.disable = function() {
$scope.disabled = !$scope.disabled;
Expand Down

0 comments on commit 9dbd758

Please sign in to comment.