Skip to content

Commit

Permalink
Connect for RTL, string fix in IE8, removed test.
Browse files Browse the repository at this point in the history
Ready for commit
  • Loading branch information
leongersen committed Nov 16, 2013
1 parent 8e539ab commit 0b4a789
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 525 deletions.
6 changes: 3 additions & 3 deletions jquery.nouislider.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
}

/* Main slider bar;
* Use outline instead of border to keep absolute
* Use box-shadow instead of border to keep absolute
* positioning unrelated to the styling.
*/
.noUi-base {
width: 100%;
margin: 1px;
height: 38px;
position: relative;
outline: 1px solid #BFBFBF;
box-shadow: 0 0 0 1px #BFBFBF;
}

/* Handles + active state;
Expand Down Expand Up @@ -71,7 +71,7 @@
bottom: 0;
border-radius: inherit;
}
.noUi-origin-upper {
.noUi-origin + .noUi-origin {
background: inherit !important;
}
.noUi-z-index {
Expand Down
34 changes: 23 additions & 11 deletions jquery.nouislider.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
q.to = filter ( q.to, 0 );

// Reverse the API for RTL sliders.
if ( o.direction ) {
if ( o.direction && q.to[1].length ) {
q.to.reverse();
}

Expand Down Expand Up @@ -718,8 +718,10 @@
// add the proper events to them or create new input fields,
// and add them as data to the handle so they can be kept
// in sync with the slider value.
$.each( serialization.to[i], function(){
elements = elements.concat( storeElement( handle, this, i ) );
$.each( serialization.to[i], function( index ){
elements = elements.concat(
storeElement( handle, serialization.to[i][index], i )
);
});

return {
Expand Down Expand Up @@ -902,15 +904,16 @@
// other function. Base is the internal main 'bar'.
var target = $(this).addClass(clsList[6]), i, handle,
base = $('<div/>').appendTo(target),
d = options.direction,
classes = {
base: [ clsList[0] ]
,origin: [
[ clsList[1], clsList[1] + clsList[7] ]
,[ clsList[1], clsList[1] + clsList[8] ]
[ clsList[1], clsList[1] + clsList[d?8:7] ]
,[ clsList[1], clsList[1] + clsList[d?7:8] ]
]
,handle: [
[ clsList[2], clsList[2] + clsList[7] ]
,[ clsList[2], clsList[2] + clsList[8] ]
[ clsList[2], clsList[2] + clsList[d?8:7] ]
,[ clsList[2], clsList[2] + clsList[d?7:8] ]
]
};

Expand All @@ -920,6 +923,15 @@
// renaming and provide a minor compression benefit.
if( options.connect ) {

if ( d ) {

if ( options.connect === 'lower' ) {
options.connect = 'upper';
} else if ( options.connect === 'upper' ) {
options.connect = 'lower';
}
}

if( options.connect === 'lower' ){
// Add some styling classes to the base;
classes.base.push(clsList[9], clsList[9] + clsList[7]);
Expand Down Expand Up @@ -953,10 +965,6 @@
classes.base.push(clsList[11]);
}

if ( options.direction ) {
target.addClass(clsList[16]);
}

// Merge base classes with default,
// and store relevant data on the base element.
base.addClass( classes.base.join(' ') ).data({
Expand All @@ -968,6 +976,10 @@
// Make data accessible in functions throughout the plugin.
target.data('base', base);

if ( d ) {
target.addClass(clsList[16]);
}

for (i = 0; i < options.handles; i++ ) {

handle = $('<div><div/></div>').appendTo(base);
Expand Down
Loading

0 comments on commit 0b4a789

Please sign in to comment.