(val)
| 196 | } |
| 197 | |
| 198 | function setValue(val) { |
| 199 | if (!height || !width) resize(false); |
| 200 | |
| 201 | //Make sure value is between 0 and 1 |
| 202 | if (val < 0) val = 0; |
| 203 | else if (val > 1) val = 1; |
| 204 | |
| 205 | scroll = val; |
| 206 | if (isVertical) $cursor.style.top = val * height + "px"; |
| 207 | else $cursor.style.left = val * width + "px"; |
| 208 | } |
| 209 | |
| 210 | function destroy() { |
| 211 | window.removeEventListener("resize", resize); |