├── favicon.ico
├── images
├── logo.png
├── close.gif
├── close.png
├── tab-bg.png
├── white.png
├── wood_1.jpg
├── btn-icons.png
├── cta-btn.png
├── headline-bg.png
├── logo_simple.png
├── broken_noise.jpg
├── config-head-bg.png
├── offset-tab-bg.png
├── subhead-mask.jpg
├── xp-vert-btns.png
├── xp-vert-handle.png
├── feature-list-bullet.png
├── folder-content-bg.png
├── black-scroll-vertical.png
├── green-horiz-scrollbar.png
├── green-vert-scrollbar.png
└── black-scroll-horizontal.png
├── README
├── .gitignore
├── bower.json
├── templates
├── doc-list.handlebars
└── doc-table.handlebars
├── css
└── README.md
├── scss
├── _print.scss
├── _helpers.scss
├── _mixins.scss
├── _shi_default.scss
└── _normalize.scss
├── package.json
├── js
├── mylibs
│ ├── shi_default.min.js
│ └── jquery.tools.min.js
├── libs
│ └── respond.src.js
└── script.js
├── humans.txt
├── license.html
├── Gruntfile.js
└── releases
├── enscroll-0.2.5.min.js
├── enscroll-0.2.6.min.js
├── enscroll-0.2.8.min.js
├── enscroll-0.2.9.min.js
├── enscroll-0.2.2.min.js
├── enscroll-0.3.0.min.js
├── enscroll-0.2.4.min.js
├── enscroll-0.4.1.min.js
├── enscroll-0.4.2.min.js
└── enscroll-0.4.0.min.js
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/favicon.ico
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/logo.png
--------------------------------------------------------------------------------
/images/close.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/close.gif
--------------------------------------------------------------------------------
/images/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/close.png
--------------------------------------------------------------------------------
/images/tab-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/tab-bg.png
--------------------------------------------------------------------------------
/images/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/white.png
--------------------------------------------------------------------------------
/images/wood_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/wood_1.jpg
--------------------------------------------------------------------------------
/images/btn-icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/btn-icons.png
--------------------------------------------------------------------------------
/images/cta-btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/cta-btn.png
--------------------------------------------------------------------------------
/images/headline-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/headline-bg.png
--------------------------------------------------------------------------------
/images/logo_simple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/logo_simple.png
--------------------------------------------------------------------------------
/images/broken_noise.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/broken_noise.jpg
--------------------------------------------------------------------------------
/images/config-head-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/config-head-bg.png
--------------------------------------------------------------------------------
/images/offset-tab-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/offset-tab-bg.png
--------------------------------------------------------------------------------
/images/subhead-mask.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/subhead-mask.jpg
--------------------------------------------------------------------------------
/images/xp-vert-btns.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/xp-vert-btns.png
--------------------------------------------------------------------------------
/images/xp-vert-handle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/xp-vert-handle.png
--------------------------------------------------------------------------------
/images/feature-list-bullet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/feature-list-bullet.png
--------------------------------------------------------------------------------
/images/folder-content-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/folder-content-bg.png
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Visit http://enscrollplugin.com/ for documentation, examples and other information about the enscroll jQuery plugin.
--------------------------------------------------------------------------------
/images/black-scroll-vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/black-scroll-vertical.png
--------------------------------------------------------------------------------
/images/green-horiz-scrollbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/green-horiz-scrollbar.png
--------------------------------------------------------------------------------
/images/green-vert-scrollbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/green-vert-scrollbar.png
--------------------------------------------------------------------------------
/images/black-scroll-horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/natanfelles/enscroll/master/images/black-scroll-horizontal.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .sass-cache/
2 | node_modules/
3 | publish/
4 | css/style.css
5 | js/documentation.js
6 | enscroll.sublime-project
7 | enscroll.sublime-workspace
8 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "enscroll",
3 | "version": "0.6.2",
4 | "main": "js/mylibs/enscroll.js",
5 | "ignore": ["**/*.md", "**/*.png", "**/*.jpg", "**/*.gif", "releases/*", "README", "**/*.html", "**/*.ico", "**/*.txt", "**/*.handlebars"],
6 | "dependencies": {"jquery": ">1.7.1"}
7 | }
8 |
--------------------------------------------------------------------------------
/templates/doc-list.handlebars:
--------------------------------------------------------------------------------
1 |
2 | {{#each this}}
3 |
4 | Property
5 | {{property}}
6 | Default Value
7 | {{value}}
8 | Description
9 | {{description}}
10 |
11 | {{/each}}
12 |
13 |
--------------------------------------------------------------------------------
/templates/doc-table.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Property
5 | Default Value
6 | Description
7 |
8 |
9 |
10 | {{#each this}}
11 |
12 | {{property}}
13 | {{value}}
14 | {{description}}
15 |
16 | {{/each}}
17 |
18 |
19 |
--------------------------------------------------------------------------------
/css/README.md:
--------------------------------------------------------------------------------
1 | # This directory is intentionally left empty
2 |
3 | Since we are now using SASS to precompile our stylesheets, the style.css file that is normally present in this directory will no longer be included in the project. Instead, you can install the sass ruby gem and precompile these stylesheets for yourself.
4 |
5 | Head over to http://sass-lang.com/ for a tutorial and instructions for installation on any platform.
6 |
7 | [@JasonStoudt](http://twitter.com/JasonStoudt) to hit me on Twitter for any questions.
8 |
9 | Thanks!
10 |
--------------------------------------------------------------------------------
/scss/_print.scss:
--------------------------------------------------------------------------------
1 | * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; }
2 | a, a:visited { text-decoration: underline; }
3 | a[href]:after { content: " (" attr(href) ")"; }
4 | abbr[title]:after { content: " (" attr(title) ")"; }
5 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; }
6 | pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
7 | thead { display: table-header-group; }
8 | tr, img { page-break-inside: avoid; }
9 | img { max-width: 100% !important; }
10 | @page { margin: 0.5cm; }
11 | p, h2, h3 { orphans: 3; widows: 3; }
12 | h2, h3 { page-break-after: avoid; }
--------------------------------------------------------------------------------
/scss/_helpers.scss:
--------------------------------------------------------------------------------
1 | /* ==|== non-semantic helper classes ======================================== */
2 |
3 | .ir {
4 | border: 0;
5 | font: 0/0 a;
6 | text-shadow: none;
7 | color: transparent;
8 | background-color: transparent;
9 | }
10 |
11 | .hidden {
12 | display: none !important;
13 | visibility: hidden;
14 | }
15 |
16 | .visuallyhidden {
17 | border: 0;
18 | clip: rect(0 0 0 0);
19 | height: 1px;
20 | margin: -1px;
21 | overflow: hidden;
22 | padding: 0;
23 | position: absolute;
24 | width: 1px;
25 | }
26 |
27 | .visuallyhidden.focusable:active,
28 | .visuallyhidden.focusable:focus {
29 | clip: auto;
30 | height: auto;
31 | margin: 0;
32 | overflow: visible;
33 | position: static;
34 | width: auto;
35 | }
36 |
37 | .invisible {
38 | visibility: hidden;
39 | }
40 |
41 | .clearfix:before,
42 | .clearfix:after {
43 | content: "";
44 | display: table;
45 | }
46 | .clearfix:after { clear: both; }
47 | .clearfix { zoom: 1; }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "enscroll",
3 | "version": "0.6.2",
4 | "description": "A jQuery plugin for creating custom scrollbars.",
5 | "main": "Gruntfile.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git://github.com/jstoudt/enscroll.git"
12 | },
13 | "keywords": [
14 | "jquery",
15 | "scrollbars",
16 | "plugin",
17 | "javascript",
18 | "css"
19 | ],
20 | "author": "Jason T. Stoudt",
21 | "license": "MIT",
22 | "readmeFilename": "README",
23 | "gitHead": "8c96a781df7a6610c50a250cd840d6654d353f4d",
24 | "bugs": {
25 | "url": "https://github.com/jstoudt/enscroll/issues"
26 | },
27 | "devDependencies": {
28 | "grunt": "^1.0.1",
29 | "grunt-contrib-clean": "^1.0.0",
30 | "grunt-contrib-concat": "^1.0.1",
31 | "grunt-contrib-connect": "^1.0.2",
32 | "grunt-contrib-copy": "^1.0.0",
33 | "grunt-contrib-handlebars": "^1.0.0",
34 | "grunt-contrib-imagemin": "^1.0.1",
35 | "grunt-contrib-jshint": "^1.0.0",
36 | "grunt-contrib-sass": "^1.0.0",
37 | "grunt-contrib-uglify": "^1.0.1",
38 | "grunt-contrib-watch": "^1.0.0",
39 | "grunt-rev": "^0.1.0",
40 | "grunt-usemin": "^3.1.1"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/js/mylibs/shi_default.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Syntax Highlighting based on 'Snippet' by SteamDev (http://steamdev.com/snippet)
3 | * http://syntaxhighlight.in v1.0.0
4 | * Date: Sunday Jan 1, 2012
5 | * version for JQuery
6 | */
7 | $(document).ready(function(){function a(b){top.consoleRef=window.open("","myconsole","width=600,height=300,left=50,top=50,menubar=0,toolbar=0,location=0,status=0,scrollbars=1,resizable=1");top.consoleRef.document.writeln("Snippet :: Code View :: "+location.href+' '+b+" ");top.consoleRef.document.close()}$(".snippet-container").each(function(b){$(this).find("a.snippet-text").click(function(){var d=$(this).parents(".snippet-wrap").find(".snippet-formatted");var c=$(this).parents(".snippet-wrap").find(".snippet-textonly");d.toggle();c.toggle();if(c.is(":visible")){$(this).html("html")}else{$(this).html("text")}return false});$(this).find("a.snippet-window").click(function(){var c=$(this).parents(".snippet-wrap").find(".snippet-textonly").html();a(c);$(this).blur();return false});$(this).hover(function(){$(this).find(".snippet-menu").fadeIn("fast")},function(){$(this).find(".snippet-menu").fadeOut("fast")})});$(".snippet-expand, .snippet-close").each(function(b){$(this).click(function(){$(this).parents(".snippet-container").find(".snippet-wrap").toggle()})})});
--------------------------------------------------------------------------------
/humans.txt:
--------------------------------------------------------------------------------
1 | /* humanstxt.org */
2 |
3 | /* MAIN */
4 | Developed by: Jason T. Stoudt
5 | Twitter: @JasonStoudt
6 | Site: http://enscrollplugin.com/
7 |
8 | /* TEAM */
9 | Developer: Jason T. Stoudt
10 | Twitter: @JasonStoudt
11 |
12 | /* THANKS */
13 | Shiva B. for the web hosting
14 |
15 | /* SITE */
16 | Code Languages: HTML5, CSS, CSS3, Javascript
17 | Components: h5bp, jQuery
18 | Software: http://sass-lang.com/
19 | http://handlebarsjs.com/
20 | http://gruntjs.com/
21 | ``
22 | `....................................................................`...` `..
23 | :////////////////////////////////////////////////////////////////////.///. `..
24 | :/:::::::///:::::::::::////::::::::///::::::::/:::::/::://::::::::///.///. `..
25 | .:////////:/.////://///-/-:///////:::-:///////:.///:://:--////////::/.///. `--
26 | ://:-:--///-.://:::-///::.///:-----:-///-:/::::.///::::--///:/:-://::.///. `::
27 | ///:::::::::.://-//-://::::::////::.://:-//////.///-///-://:://--///:.///. `::
28 | ://:-::::---.///://-://::---:---///--///-::::--.///-///:-///-::-///:/.///. `::
29 | .::////////:.///://-://::-////////://::///////:.///-////:::///////://.+/+. `..
30 | `..```````...````...````..```````.......`````..`````.......``..``....```` `..`
31 | `..````````````````.````````````````````````````````````````````````````````
32 | `..-::::::::::::::::::-.......................................................
33 |
--------------------------------------------------------------------------------
/scss/_mixins.scss:
--------------------------------------------------------------------------------
1 | /*=====================================
2 | * Mixins for various styles
3 | *====================================*/
4 |
5 | @mixin monospace() {
6 | font-family: monospace, monospace;
7 | _font-family: "Courier New", monospace;
8 | }
9 |
10 | @mixin box-shadow($opacity, $x, $y, $blur, $spread) {
11 | -webkit-box-shadow: rgba(0, 0, 0, $opacity) $x $y $blur $spread;
12 | box-shadow: rgba(0, 0, 0, $opacity) $x $y $blur $spread;
13 | }
14 |
15 | @mixin inset-box-shadow($opacity, $x, $y, $blur, $spread) {
16 | -webkit-box-shadow: rgba(0, 0, 0, $opacity) $x $y $blur $spread inset;
17 | box-shadow: rgba(0, 0, 0, $opacity) $x $y $blur $spread inset;
18 | }
19 |
20 | @mixin box-shadow-off {
21 | -webkit-box-shadow: none;
22 | box-shadow: none;
23 | }
24 |
25 | @mixin border-radius($radius) {
26 | -webkit-border-radius: $radius;
27 | border-radius: $radius;
28 | }
29 |
30 | @mixin transition($val) {
31 | -webkit-transition: $val;
32 | transition: $val;
33 | }
34 |
35 | @mixin linear-gradient($top, $bottom) {
36 | background: -webkit-linear-gradient(top, $top, $bottom);
37 | background: -moz-linear-gradient(top, $top, $bottom);
38 | background: -ms-linear-gradient(top, $top, $bottom);
39 | background: linear-gradient(top, $top, $bottom);
40 | }
41 |
42 | @mixin linear-gradient-four($first, $second, $third, $fourth) {
43 | background: -webkit-linear-gradient(top, $first, $second, $third, $fourth);
44 | background: -moz-linear-gradient(top, $first, $second, $third, $fourth);
45 | background: -ms-linear-gradient(top, $first, $second, $third, $fourth);
46 | background: linear-gradient(top, $first, $second, $third, $fourth);
47 | }
48 |
49 | @mixin animate($name, $duration, $iterations : 1) {
50 | -webkit-animation-name: $name;
51 | -webkit-animation-duration: $duration;
52 | -webkit-animation-iteration-count: $iterations;
53 |
54 | animation-name: $name;
55 | animation-duration: $duration;
56 | animation-iteration-count: $iterations;
57 | }
58 |
--------------------------------------------------------------------------------
/license.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | The MIT License (MIT)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
28 |
The MIT License (MIT)
29 |
Copyright © 2014 Jason T. Stoudt
30 |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
31 |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
32 |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 |
34 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/scss/_shi_default.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * Syntax Highlighting based on 'Snippet' by SteamDev (http://steamdev.com/snippet)
3 | * http://syntaxhighlight.in v1.0.0
4 | * Date: Sunday Jan 1, 2012
5 | *
6 | * .sh_sourceCode is the
7 | */.sh_default{background:0;padding:0;margin:0;border:0 none}.sh_default pre{background-color:#e7e5dc;color:#5c5c5c;font-weight:normal;font-style:normal;padding:.5em!important;-moz-border-radius:3px!important;-webkit-border-radius:3px!important;border-radius:3px!important;-moz-box-shadow:1px 1px 3px 1px #888!important;-webkit-box-shadow:1px 1px 3px 1px #888!important;box-shadow:1px 1px 3px 1px #888!important}.sh_default .snippet-formatted .snippet-num{margin:0;padding-left:4em}.sh_default .sh_sourceCode li{background-color:#fff;border-left:3px solid #6ce26c}.sh_default .sh_sourceCode li:nth-child(odd){background-color:#f8f8f8}.sh_default .sh_sourceCode .sh_keyword{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_type{color:#8080c0;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_string{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_regexp{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_specialchar{color:#f0f;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_comment{color:#ff8000;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_number{color:#800080;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_preproc{color:#0080c0;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_symbol{color:#ff0080;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_function{color:#046;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_cbracket{color:#ff0080;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_url{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_date{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_time{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_file{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_ip{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_name{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_variable{color:#0080c0;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_oldfile{color:#f0f;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_newfile{color:#a68500;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_difflines{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_selector{color:#0080c0;font-weight:normal;font-style:normal}.sh_default .sh_sourceCode .sh_property{color:#bb7977;font-weight:bold;font-style:normal}.sh_default .sh_sourceCode .sh_value{color:#a68500;font-weight:normal;font-style:normal}.snippet-textonly:focus{background:#333!important;color:#fff!important}.snippet-wrap{position:relative}.snippet-wrap{*display:inline-block}.snippet-reveal{text-decoration:underline}.snippet-wrap .snippet-menu,.snippet-wrap .snippet-hide{position:absolute;top:10px;right:15px;font-size:.9em;z-index:10;background-color:transparent}.snippet-wrap .snippet-hide{top:auto;bottom:10px;z-index:5}.snippet-wrap .snippet-hide{*bottom:25px}.snippet-wrap .snippet-menu pre,.snippet-wrap .snippet-hide pre{margin:0;padding:0}.snippet-wrap .snippet-menu a,.snippet-wrap .snippet-hide a{padding:0 5px;text-decoration:underline}.snippet-wrap pre.sh_sourceCode{padding:1em;line-height:1.8em;overflow:auto;position:relative;-moz-border-radius:15px;-webkit-border-radius:15px;border-radius:15px;box-shadow:2px 2px 5px #000;-moz-box-shadow:2px 2px 5px #000;-webkit-box-shadow:2px 2px 5px #000}.snippet-wrap pre.snippet-textonly{padding:2em}.snippet-wrap pre.snippet-formatted{*padding:2em 1em}.snippet-reveal pre.sh_sourceCode{padding:.5em 1em;text-align:right}.snippet-wrap .snippet-num li{padding-left:1.5em}.snippet-wrap .snippet-no-num{list-style:none;padding:0;margin:0}.snippet-wrap .snippet-no-num li{list-style:none;padding-left:0}.snippet-wrap .snippet-num{margin:1em 0 1em 1em;padding-left:3em}.snippet-wrap .snippet-num li{list-style:decimal-leading-zero outside none}.snippet-wrap .snippet-no-num li.box{padding:0 6px;margin-left:-6px}.snippet-wrap .snippet-num li.box{border:1px solid;list-style-position:inside;margin-left:-3em;padding-left:6px}.snippet-wrap .snippet-num li.box{*margin-left:-2.4em}.snippet-wrap li.box-top{border-width:1px 1px 0!important}.snippet-wrap li.box-bot{border-width:0 1px 1px!important}.snippet-wrap li.box-mid{border-width:0 1px!important}.snippet-wrap .snippet-num li .box-sp{width:18px;display:inline-block}.snippet-wrap .snippet-num li .box-sp{*width:27px}.snippet-wrap .snippet-no-num li.box{border:1px solid}.snippet-wrap .snippet-no-num li .box-sp{display:none}.snippet-menu{left:-999em;display:block!important}.snippet-container:hover .snippet-text,.snippet-container .snippet-text:focus{right:10px;position:absolute}.snippet-container:hover .snippet-window,.snippet-container .snippet-window:focus{right:40px;position:absolute}
8 | .snippet-hide pre{background:#fff!important}.snippet-hide pre a{color:#333!important}#d_clip_container{position:relative}
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | /*global module:false*/
2 | module.exports = function(grunt) {
3 |
4 | // Project configuration.
5 | grunt.initConfig({
6 | // Metadata.
7 | pkg: grunt.file.readJSON('package.json'),
8 | banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
9 | '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
10 | '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
11 | '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
12 | ' Licensed <%= _.map(pkg.licenses, "type").join(", ") %> */\n',
13 | // Task configuration.
14 | clean: {
15 | prebuild: 'publish',
16 | postbuild: [
17 | 'publish/libs/modernizr.js',
18 | 'publish/js/script.js',
19 | 'publish/js/modernizr.min.js',
20 | 'publish/js/script.min.js',
21 | 'publish/css/style.css'
22 | ]
23 | },
24 | handlebars: {
25 | compile: {
26 | files: {
27 | 'js/documentation.js': ['templates/*.handlebars']
28 | }
29 | }
30 | },
31 | sass: {
32 | all: {
33 | options: {
34 | style: 'compact'
35 | },
36 | files: {
37 | 'css/style.css': 'scss/style.scss'
38 | }
39 | }
40 | },
41 | concat: {
42 | options: {
43 | banner: '<%= banner %>',
44 | stripBanners: true
45 | },
46 | headscript: {
47 | src: [
48 | 'js/libs/respond.src.js',
49 | 'js/libs/modernizr-2.6.2.custom.js'
50 | ],
51 | dest: 'publish/js/libs/modernizr.js'
52 | },
53 | bodyscript: {
54 | src: [
55 | 'js/mylibs/jquery.tools.min.js',
56 | 'js/mylibs/shi_default.min.js',
57 | 'js/mylibs/handlebars.runtime.js',
58 | 'js/documentation.js',
59 | 'js/mylibs/enscroll.js',
60 | 'js/script.js'
61 | ],
62 | dest: 'publish/js/script.js'
63 | }
64 | },
65 | uglify: {
66 | options: {
67 | banner: '<%= banner %>'
68 | },
69 | headscript: {
70 | src: '<%= concat.headscript.dest %>',
71 | dest: 'publish/js/modernizr.min.js'
72 | },
73 | bodyscript: {
74 | src: '<%= concat.bodyscript.dest %>',
75 | dest: 'publish/js/script.min.js'
76 | },
77 | release: {
78 | src: 'js/mylibs/enscroll.js',
79 | dest: 'releases/enscroll-<%= pkg.version %>.min.js'
80 | }
81 | },
82 | jshint: {
83 | options: {
84 | curly: true,
85 | eqeqeq: true,
86 | immed: true,
87 | latedef: true,
88 | newcap: true,
89 | noarg: true,
90 | sub: true,
91 | undef: true,
92 | unused: true,
93 | boss: true,
94 | eqnull: true,
95 | browser: true,
96 | globals: {
97 | jQuery: true
98 | }
99 | },
100 | gruntfile: {
101 | src: 'Gruntfile.js'
102 | },
103 | all: ['Gruntfile.js', 'js/script.js', 'js/mylibs/enscroll.js']
104 | },
105 | imagemin: {
106 | all: {
107 | options: {
108 | optimizationLevel: 3
109 | },
110 | files: [{
111 | expand: true,
112 | cwd: 'images/',
113 | src: ['**/*.{png,jpg,gif}'],
114 | dest: 'publish/images'
115 | }]
116 | }
117 | },
118 | copy: {
119 | all: {
120 | files: [{
121 | src: [
122 | 'images/*.gif',
123 | '*.html',
124 | '*.txt',
125 | 'css/*.css',
126 | 'releases/*',
127 | 'favicon.ico'
128 | ],
129 | dest: 'publish/',
130 | filter: 'isFile'
131 | }]
132 | }
133 | },
134 | rev: {
135 | css: {
136 | src: ['publish/css/style.css'],
137 | dest: 'publish/css'
138 | },
139 | script: {
140 | src: ['publish/js/script.min.js', 'publish/js/modernizr.min.js'],
141 | dest: 'publish/js'
142 | }
143 | },
144 | usemin: {
145 | html: [
146 | 'publish/index.html',
147 | 'publish/license.html',
148 | 'publish/404.html'
149 | ],
150 | options: {
151 | basedir: 'publish'
152 | }
153 | },
154 | watch: {
155 | options: {
156 | livereload: true
157 | },
158 | gruntfile: {
159 | files: '<%= jshint.gruntfile.src %>',
160 | tasks: ['jshint:gruntfile']
161 | },
162 | handlebars: {
163 | files: ['templates/*.handlebars'],
164 | tasks: ['handlebars']
165 | },
166 | sass: {
167 | files: ['scss/*.scss'],
168 | tasks: ['sass']
169 | },
170 | html: {
171 | files: ['*.html']
172 | }
173 | },
174 | connect: {
175 | enscroll: {
176 | options: {
177 | port: 8000,
178 | base: 'publish',
179 | keepalive: true,
180 | hostname: '*'
181 | }
182 | }
183 | }
184 | });
185 |
186 | // These plugins provide necessary tasks.
187 | grunt.loadNpmTasks('grunt-contrib-concat');
188 | grunt.loadNpmTasks('grunt-contrib-uglify');
189 | grunt.loadNpmTasks('grunt-contrib-jshint');
190 | grunt.loadNpmTasks('grunt-contrib-watch');
191 | grunt.loadNpmTasks('grunt-contrib-handlebars');
192 | grunt.loadNpmTasks('grunt-contrib-imagemin');
193 | grunt.loadNpmTasks('grunt-contrib-clean');
194 | grunt.loadNpmTasks('grunt-contrib-sass');
195 | grunt.loadNpmTasks('grunt-contrib-copy');
196 | grunt.loadNpmTasks('grunt-contrib-connect');
197 | grunt.loadNpmTasks('grunt-rev');
198 | grunt.loadNpmTasks('grunt-usemin');
199 |
200 | // Default task.
201 | grunt.registerTask('default', [
202 | 'clean:prebuild',
203 | 'jshint',
204 | 'handlebars',
205 | 'sass',
206 | 'copy:all',
207 | 'concat',
208 | 'uglify:headscript',
209 | 'uglify:bodyscript',
210 | 'imagemin',
211 | 'rev',
212 | 'usemin',
213 | 'clean:postbuild'
214 | ]);
215 |
216 | grunt.registerTask('serve', ['default', 'connect:enscroll']);
217 | grunt.registerTask('release', ['uglify:release']);
218 |
219 | };
220 |
--------------------------------------------------------------------------------
/js/mylibs/jquery.tools.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery Tools v1.2.7 - The missing UI library for the Web
3 | *
4 | * overlay/overlay.js
5 | * overlay/overlay.apple.js
6 | * toolbox/toolbox.expose.js
7 | *
8 | * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
9 | *
10 | * http://flowplayer.org/tools/
11 | *
12 | */
13 | (function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:true,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth(true),q=j.outerHeight(true);typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a(" "),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);
14 | (function(a){var b=a.tools.overlay,c=a(window);a.extend(b.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function d(a){var b=a.offset();return{top:b.top+a.height()/2,left:b.left+a.width()/2}}var e=function(b,e){var f=this.getOverlay(),g=this.getConf(),h=this.getTrigger(),i=this,j=f.outerWidth(true),k=f.data("img"),l=g.fixed?"fixed":"absolute";if(!k){var m=f.css("backgroundImage");if(!m)throw"background-image CSS property not set for overlay";m=m.slice(m.indexOf("(")+1,m.indexOf(")")).replace(/\"/g,""),f.css("backgroundImage","none"),k=a(" "),k.css({border:0,display:"none"}).width(j),a("body").append(k),f.data("img",k)}var n=g.start.top||Math.round(c.height()/2),o=g.start.left||Math.round(c.width()/2);if(h){var p=d(h);n=p.top,o=p.left}g.fixed?(n-=c.scrollTop(),o-=c.scrollLeft()):(b.top+=c.scrollTop(),b.left+=c.scrollLeft()),k.css({position:"absolute",top:n,left:o,width:0,zIndex:g.zIndex}).show(),b.position=l,f.css(b),k.animate({top:b.top,left:b.left,width:j},g.speed,function(){f.css("zIndex",g.zIndex+1).fadeIn(g.fadeInSpeed,function(){i.isOpened()&&!a(this).index(f)?e.call():f.hide()})}).css("position",l)},f=function(b){var e=this.getOverlay().hide(),f=this.getConf(),g=this.getTrigger(),h=e.data("img"),i={top:f.start.top,left:f.start.left,width:0};g&&a.extend(i,d(g)),f.fixed&&h.css({position:"absolute"}).animate({top:"+="+c.scrollTop(),left:"+="+c.scrollLeft()},0),h.animate(i,f.closeSpeed,b)};b.addEffect("apple",e,f)})(jQuery);
15 | (function(a){a.tools=a.tools||{version:"v1.2.7"};var b;b=a.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};function c(){if(a.browser.msie){var b=a(document).height(),c=a(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,b-c<20?c:b]}return[a(document).width(),a(document).height()]}function d(b){if(b)return b.call(a.mask)}var e,f,g,h,i;a.mask={load:function(j,k){if(g)return this;typeof j=="string"&&(j={color:j}),j=j||h,h=j=a.extend(a.extend({},b.conf),j),e=a("#"+j.maskId),e.length||(e=a("
").attr("id",j.maskId),a("body").append(e));var l=c();e.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:j.startOpacity,zIndex:j.zIndex}),j.color&&e.css("backgroundColor",j.color);if(d(j.onBeforeLoad)===!1)return this;j.closeOnEsc&&a(document).on("keydown.mask",function(b){b.keyCode==27&&a.mask.close(b)}),j.closeOnClick&&e.on("click.mask",function(b){a.mask.close(b)}),a(window).on("resize.mask",function(){a.mask.fit()}),k&&k.length&&(i=k.eq(0).css("zIndex"),a.each(k,function(){var b=a(this);/relative|absolute|fixed/i.test(b.css("position"))||b.css("position","relative")}),f=k.css({zIndex:Math.max(j.zIndex+1,i=="auto"?0:i)})),e.css({display:"block"}).fadeTo(j.loadSpeed,j.opacity,function(){a.mask.fit(),d(j.onLoad),g="full"}),g=!0;return this},close:function(){if(g){if(d(h.onBeforeClose)===!1)return this;e.fadeOut(h.closeSpeed,function(){d(h.onClose),f&&f.css({zIndex:i}),g=!1}),a(document).off("keydown.mask"),e.off("click.mask"),a(window).off("resize.mask")}return this},fit:function(){if(g){var a=c();e.css({width:a[0],height:a[1]})}},getMask:function(){return e},isLoaded:function(a){return a?g=="full":g},getConf:function(){return h},getExposed:function(){return f}},a.fn.mask=function(b){a.mask.load(b);return this},a.fn.expose=function(b){a.mask.load(b,this);return this}})(jQuery);
16 |
--------------------------------------------------------------------------------
/js/libs/respond.src.js:
--------------------------------------------------------------------------------
1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
3 | window.matchMedia = window.matchMedia || (function(doc, undefined){
4 |
5 | var bool,
6 | docElem = doc.documentElement,
7 | refNode = docElem.firstElementChild || docElem.firstChild,
8 | // fakeBody required for
9 | fakeBody = doc.createElement('body'),
10 | div = doc.createElement('div');
11 |
12 | div.id = 'mq-test-1';
13 | div.style.cssText = "position:absolute;top:-100em";
14 | fakeBody.style.background = "none";
15 | fakeBody.appendChild(div);
16 |
17 | return function(q){
18 |
19 | div.innerHTML = '';
20 |
21 | docElem.insertBefore(fakeBody, refNode);
22 | bool = div.offsetWidth == 42;
23 | docElem.removeChild(fakeBody);
24 |
25 | return { matches: bool, media: q };
26 | };
27 |
28 | })(document);
29 |
30 |
31 |
32 |
33 | /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
34 | (function( win ){
35 | //exposed namespace
36 | win.respond = {};
37 |
38 | //define update even in native-mq-supporting browsers, to avoid errors
39 | respond.update = function(){};
40 |
41 | //expose media query support flag for external use
42 | respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches;
43 |
44 | //if media queries are supported, exit here
45 | if( respond.mediaQueriesSupported ){ return; }
46 |
47 | //define vars
48 | var doc = win.document,
49 | docElem = doc.documentElement,
50 | mediastyles = [],
51 | rules = [],
52 | appendedEls = [],
53 | parsedSheets = {},
54 | resizeThrottle = 30,
55 | head = doc.getElementsByTagName( "head" )[0] || docElem,
56 | base = doc.getElementsByTagName( "base" )[0],
57 | links = head.getElementsByTagName( "link" ),
58 | requestQueue = [],
59 |
60 | //loop stylesheets, send text content to translate
61 | ripCSS = function(){
62 | var sheets = links,
63 | sl = sheets.length,
64 | i = 0,
65 | //vars for loop:
66 | sheet, href, media, isCSS;
67 |
68 | for( ; i < sl; i++ ){
69 | sheet = sheets[ i ],
70 | href = sheet.href,
71 | media = sheet.media,
72 | isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
73 |
74 | //only links plz and prevent re-parsing
75 | if( !!href && isCSS && !parsedSheets[ href ] ){
76 | // selectivizr exposes css through the rawCssText expando
77 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
78 | translate( sheet.styleSheet.rawCssText, href, media );
79 | parsedSheets[ href ] = true;
80 | } else {
81 | if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base)
82 | || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
83 | requestQueue.push( {
84 | href: href,
85 | media: media
86 | } );
87 | }
88 | }
89 | }
90 | }
91 | makeRequests();
92 | },
93 |
94 | //recurse through request queue, get css text
95 | makeRequests = function(){
96 | if( requestQueue.length ){
97 | var thisRequest = requestQueue.shift();
98 |
99 | ajax( thisRequest.href, function( styles ){
100 | translate( styles, thisRequest.href, thisRequest.media );
101 | parsedSheets[ thisRequest.href ] = true;
102 |
103 | // by wrapping recursive function call in setTimeout
104 | // we prevent "Stack overflow" error in IE7
105 | setTimeout(function(){ makeRequests(); },0);
106 | } );
107 | }
108 | },
109 |
110 | //find media blocks in css text, convert to style blocks
111 | translate = function( styles, href, media ){
112 | var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
113 | ql = qs && qs.length || 0,
114 | //try to get CSS path
115 | href = href.substring( 0, href.lastIndexOf( "/" )),
116 | repUrls = function( css ){
117 | return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
118 | },
119 | useMedia = !ql && media,
120 | //vars used in loop
121 | i = 0,
122 | j, fullq, thisq, eachq, eql;
123 |
124 | //if path exists, tack on trailing slash
125 | if( href.length ){ href += "/"; }
126 |
127 | //if no internal queries exist, but media attr does, use that
128 | //note: this currently lacks support for situations where a media attr is specified on a link AND
129 | //its associated stylesheet has internal CSS media queries.
130 | //In those cases, the media attribute will currently be ignored.
131 | if( useMedia ){
132 | ql = 1;
133 | }
134 |
135 |
136 | for( ; i < ql; i++ ){
137 | j = 0;
138 |
139 | //media attr
140 | if( useMedia ){
141 | fullq = media;
142 | rules.push( repUrls( styles ) );
143 | }
144 | //parse for styles
145 | else{
146 | fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
147 | rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
148 | }
149 |
150 | eachq = fullq.split( "," );
151 | eql = eachq.length;
152 |
153 | for( ; j < eql; j++ ){
154 | thisq = eachq[ j ];
155 | mediastyles.push( {
156 | media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
157 | rules : rules.length - 1,
158 | hasquery: thisq.indexOf("(") > -1,
159 | minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
160 | maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
161 | } );
162 | }
163 | }
164 |
165 | applyMedia();
166 | },
167 |
168 | lastCall,
169 |
170 | resizeDefer,
171 |
172 | // returns the value of 1em in pixels
173 | getEmValue = function() {
174 | var ret,
175 | div = doc.createElement('div'),
176 | body = doc.body,
177 | fakeUsed = false;
178 |
179 | div.style.cssText = "position:absolute;font-size:1em;width:1em";
180 |
181 | if( !body ){
182 | body = fakeUsed = doc.createElement( "body" );
183 | body.style.background = "none";
184 | }
185 |
186 | body.appendChild( div );
187 |
188 | docElem.insertBefore( body, docElem.firstChild );
189 |
190 | ret = div.offsetWidth;
191 |
192 | if( fakeUsed ){
193 | docElem.removeChild( body );
194 | }
195 | else {
196 | body.removeChild( div );
197 | }
198 |
199 | //also update eminpx before returning
200 | ret = eminpx = parseFloat(ret);
201 |
202 | return ret;
203 | },
204 |
205 | //cached container for 1em value, populated the first time it's needed
206 | eminpx,
207 |
208 | //enable/disable styles
209 | applyMedia = function( fromResize ){
210 | var name = "clientWidth",
211 | docElemProp = docElem[ name ],
212 | currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
213 | styleBlocks = {},
214 | lastLink = links[ links.length-1 ],
215 | now = (new Date()).getTime();
216 |
217 | //throttle resize calls
218 | if( fromResize && lastCall && now - lastCall < resizeThrottle ){
219 | clearTimeout( resizeDefer );
220 | resizeDefer = setTimeout( applyMedia, resizeThrottle );
221 | return;
222 | }
223 | else {
224 | lastCall = now;
225 | }
226 |
227 | for( var i in mediastyles ){
228 | var thisstyle = mediastyles[ i ],
229 | min = thisstyle.minw,
230 | max = thisstyle.maxw,
231 | minnull = min === null,
232 | maxnull = max === null,
233 | em = "em";
234 |
235 | if( !!min ){
236 | min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
237 | }
238 | if( !!max ){
239 | max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
240 | }
241 |
242 | // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
243 | if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
244 | if( !styleBlocks[ thisstyle.media ] ){
245 | styleBlocks[ thisstyle.media ] = [];
246 | }
247 | styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
248 | }
249 | }
250 |
251 | //remove any existing respond style element(s)
252 | for( var i in appendedEls ){
253 | if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){
254 | head.removeChild( appendedEls[ i ] );
255 | }
256 | }
257 |
258 | //inject active styles, grouped by media type
259 | for( var i in styleBlocks ){
260 | var ss = doc.createElement( "style" ),
261 | css = styleBlocks[ i ].join( "\n" );
262 |
263 | ss.type = "text/css";
264 | ss.media = i;
265 |
266 | //originally, ss was appended to a documentFragment and sheets were appended in bulk.
267 | //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
268 | head.insertBefore( ss, lastLink.nextSibling );
269 |
270 | if ( ss.styleSheet ){
271 | ss.styleSheet.cssText = css;
272 | }
273 | else {
274 | ss.appendChild( doc.createTextNode( css ) );
275 | }
276 |
277 | //push to appendedEls to track for later removal
278 | appendedEls.push( ss );
279 | }
280 | },
281 | //tweaked Ajax functions from Quirksmode
282 | ajax = function( url, callback ) {
283 | var req = xmlHttp();
284 | if (!req){
285 | return;
286 | }
287 | req.open( "GET", url, true );
288 | req.onreadystatechange = function () {
289 | if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
290 | return;
291 | }
292 | callback( req.responseText );
293 | }
294 | if ( req.readyState == 4 ){
295 | return;
296 | }
297 | req.send( null );
298 | },
299 | //define ajax obj
300 | xmlHttp = (function() {
301 | var xmlhttpmethod = false;
302 | try {
303 | xmlhttpmethod = new XMLHttpRequest();
304 | }
305 | catch( e ){
306 | xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
307 | }
308 | return function(){
309 | return xmlhttpmethod;
310 | };
311 | })();
312 |
313 | //translate CSS
314 | ripCSS();
315 |
316 | //expose update for re-running respond later on
317 | respond.update = ripCSS;
318 |
319 | //adjust on resize
320 | function callMedia(){
321 | applyMedia( true );
322 | }
323 | if( win.addEventListener ){
324 | win.addEventListener( "resize", callMedia, false );
325 | }
326 | else if( win.attachEvent ){
327 | win.attachEvent( "onresize", callMedia );
328 | }
329 | })(this);
330 |
--------------------------------------------------------------------------------
/scss/_normalize.scss:
--------------------------------------------------------------------------------
1 | /*! normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */
2 |
3 | /* =============================================================================
4 | HTML5 display definitions
5 | ========================================================================== */
6 |
7 | /*
8 | * Corrects block display not defined in IE6/7/8/9 & FF3
9 | */
10 |
11 | article,
12 | aside,
13 | details,
14 | figcaption,
15 | figure,
16 | footer,
17 | header,
18 | hgroup,
19 | nav,
20 | section,
21 | summary {
22 | display: block;
23 | }
24 |
25 | /*
26 | * Corrects inline-block display not defined in IE6/7/8/9 & FF3
27 | */
28 |
29 | audio,
30 | canvas,
31 | video {
32 | display: inline-block;
33 | *display: inline;
34 | *zoom: 1;
35 | }
36 |
37 | /*
38 | * Prevents modern browsers from displaying 'audio' without controls
39 | */
40 |
41 | audio:not([controls]) {
42 | display: none;
43 | }
44 |
45 | /*
46 | * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
47 | * Known issue: no IE6 support
48 | */
49 |
50 | [hidden] {
51 | display: none;
52 | }
53 |
54 |
55 | /* =============================================================================
56 | Base
57 | ========================================================================== */
58 |
59 | /*
60 | * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
61 | * http://clagnut.com/blog/348/#c790
62 | * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom
63 | * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
64 | */
65 |
66 | html {
67 | font-size: 100%; /* 1 */
68 | -webkit-text-size-adjust: 100%; /* 2 */
69 | -ms-text-size-adjust: 100%; /* 2 */
70 | }
71 |
72 | /*
73 | * Addresses font-family inconsistency between 'textarea' and other form elements.
74 | */
75 |
76 | html,
77 | button,
78 | input,
79 | select,
80 | textarea {
81 | font-family: sans-serif;
82 | }
83 |
84 | /*
85 | * Addresses margins handled incorrectly in IE6/7
86 | */
87 |
88 | body {
89 | margin: 0;
90 | }
91 |
92 |
93 | /* =============================================================================
94 | Links
95 | ========================================================================== */
96 |
97 | /*
98 | * Addresses outline displayed oddly in Chrome
99 | */
100 |
101 | a:focus {
102 | outline: thin dotted;
103 | }
104 |
105 | /*
106 | * Improves readability when focused and also mouse hovered in all browsers
107 | * people.opera.com/patrickl/experiments/keyboard/test
108 | */
109 |
110 | a:hover,
111 | a:active {
112 | outline: 0;
113 | }
114 |
115 |
116 | /* =============================================================================
117 | Typography
118 | ========================================================================== */
119 |
120 | /*
121 | * Addresses font sizes and margins set differently in IE6/7
122 | * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5
123 | */
124 |
125 | h1 {
126 | font-size: 2em;
127 | margin: 0.67em 0;
128 | }
129 |
130 | h2 {
131 | font-size: 1.5em;
132 | margin: 0.83em 0;
133 | }
134 |
135 | h3 {
136 | font-size: 1.17em;
137 | margin: 1em 0;
138 | }
139 |
140 | h4 {
141 | font-size: 1em;
142 | margin: 1.33em 0;
143 | }
144 |
145 | h5 {
146 | font-size: 0.83em;
147 | margin: 1.67em 0;
148 | }
149 |
150 | h6 {
151 | font-size: 0.75em;
152 | margin: 2.33em 0;
153 | }
154 |
155 | /*
156 | * Addresses styling not present in IE7/8/9, S5, Chrome
157 | */
158 |
159 | abbr[title] {
160 | border-bottom: 1px dotted;
161 | }
162 |
163 | /*
164 | * Addresses style set to 'bolder' in FF3+, S4/5, Chrome
165 | */
166 |
167 | b,
168 | strong {
169 | font-weight: bold;
170 | }
171 |
172 | blockquote {
173 | margin: 1em 40px;
174 | }
175 |
176 | /*
177 | * Addresses styling not present in S5, Chrome
178 | */
179 |
180 | dfn {
181 | font-style: italic;
182 | }
183 |
184 | /*
185 | * Addresses styling not present in IE6/7/8/9
186 | */
187 |
188 | mark {
189 | background: #ff0;
190 | color: #000;
191 | }
192 |
193 | /*
194 | * Addresses margins set differently in IE6/7
195 | */
196 |
197 | p,
198 | pre {
199 | margin: 1em 0;
200 | }
201 |
202 | /*
203 | * Corrects font family set oddly in IE6, S4/5, Chrome
204 | * en.wikipedia.org/wiki/User:Davidgothberg/Test59
205 | */
206 |
207 | pre,
208 | code,
209 | kbd,
210 | samp {
211 | font-family: monospace, serif;
212 | _font-family: 'courier new', monospace;
213 | font-size: 1em;
214 | }
215 |
216 | /*
217 | * Improves readability of pre-formatted text in all browsers
218 | */
219 |
220 | pre {
221 | white-space: pre;
222 | white-space: pre-wrap;
223 | word-wrap: break-word;
224 | }
225 |
226 | /*
227 | * 1. Addresses CSS quotes not supported in IE6/7
228 | * 2. Addresses quote property not supported in S4
229 | */
230 |
231 | /* 1 */
232 |
233 | q {
234 | quotes: none;
235 | }
236 |
237 | /* 2 */
238 |
239 | q:before,
240 | q:after {
241 | content: '';
242 | content: none;
243 | }
244 |
245 | small {
246 | font-size: 75%;
247 | }
248 |
249 | /*
250 | * Prevents sub and sup affecting line-height in all browsers
251 | * gist.github.com/413930
252 | */
253 |
254 | sub,
255 | sup {
256 | font-size: 75%;
257 | line-height: 0;
258 | position: relative;
259 | vertical-align: baseline;
260 | }
261 |
262 | sup {
263 | top: -0.5em;
264 | }
265 |
266 | sub {
267 | bottom: -0.25em;
268 | }
269 |
270 |
271 | /* =============================================================================
272 | Lists
273 | ========================================================================== */
274 |
275 | /*
276 | * Addresses margins set differently in IE6/7
277 | */
278 |
279 | dl,
280 | menu,
281 | ol,
282 | ul {
283 | margin: 1em 0;
284 | }
285 |
286 | dd {
287 | margin: 0 0 0 40px;
288 | }
289 |
290 | /*
291 | * Addresses paddings set differently in IE6/7
292 | */
293 |
294 | menu,
295 | ol,
296 | ul {
297 | padding: 0 0 0 40px;
298 | }
299 |
300 | /*
301 | * Corrects list images handled incorrectly in IE7
302 | */
303 |
304 | nav ul,
305 | nav ol {
306 | list-style: none;
307 | list-style-image: none;
308 | }
309 |
310 |
311 | /* =============================================================================
312 | Embedded content
313 | ========================================================================== */
314 |
315 | /*
316 | * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
317 | * 2. Improves image quality when scaled in IE7
318 | * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
319 | */
320 |
321 | img {
322 | border: 0; /* 1 */
323 | -ms-interpolation-mode: bicubic; /* 2 */
324 | }
325 |
326 | /*
327 | * Corrects overflow displayed oddly in IE9
328 | */
329 |
330 | svg:not(:root) {
331 | overflow: hidden;
332 | }
333 |
334 |
335 | /* =============================================================================
336 | Figures
337 | ========================================================================== */
338 |
339 | /*
340 | * Addresses margin not present in IE6/7/8/9, S5, O11
341 | */
342 |
343 | figure {
344 | margin: 0;
345 | }
346 |
347 |
348 | /* =============================================================================
349 | Forms
350 | ========================================================================== */
351 |
352 | /*
353 | * Corrects margin displayed oddly in IE6/7
354 | */
355 |
356 | form {
357 | margin: 0;
358 | }
359 |
360 | /*
361 | * Define consistent border, margin, and padding
362 | */
363 |
364 | fieldset {
365 | border: 1px solid #c0c0c0;
366 | margin: 0 2px;
367 | padding: 0.35em 0.625em 0.75em;
368 | }
369 |
370 | /*
371 | * 1. Corrects color not being inherited in IE6/7/8/9
372 | * 2. Corrects text not wrapping in FF3
373 | * 3. Corrects alignment displayed oddly in IE6/7
374 | */
375 |
376 | legend {
377 | border: 0; /* 1 */
378 | padding: 0;
379 | white-space: normal; /* 2 */
380 | *margin-left: -7px; /* 3 */
381 | }
382 |
383 | /*
384 | * 1. Corrects font size not being inherited in all browsers
385 | * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
386 | * 3. Improves appearance and consistency in all browsers
387 | */
388 |
389 | button,
390 | input,
391 | select,
392 | textarea {
393 | font-size: 100%; /* 1 */
394 | margin: 0; /* 2 */
395 | vertical-align: baseline; /* 3 */
396 | *vertical-align: middle; /* 3 */
397 | }
398 |
399 | /*
400 | * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
401 | */
402 |
403 | button,
404 | input {
405 | line-height: normal; /* 1 */
406 | }
407 |
408 | /*
409 | * 1. Improves usability and consistency of cursor style between image-type 'input' and others
410 | * 2. Corrects inability to style clickable 'input' types in iOS
411 | * 3. Removes inner spacing in IE7 without affecting normal text inputs
412 | * Known issue: inner spacing remains in IE6
413 | */
414 |
415 | button,
416 | input[type="button"],
417 | input[type="reset"],
418 | input[type="submit"] {
419 | cursor: pointer; /* 1 */
420 | -webkit-appearance: button; /* 2 */
421 | *overflow: visible; /* 3 */
422 | }
423 |
424 | /*
425 | * Re-set default cursor for disabled elements
426 | */
427 |
428 | button[disabled],
429 | input[disabled] {
430 | cursor: default;
431 | }
432 |
433 | /*
434 | * 1. Addresses box sizing set to content-box in IE8/9
435 | * 2. Removes excess padding in IE8/9
436 | * 3. Removes excess padding in IE7
437 | Known issue: excess padding remains in IE6
438 | */
439 |
440 | input[type="checkbox"],
441 | input[type="radio"] {
442 | box-sizing: border-box; /* 1 */
443 | padding: 0; /* 2 */
444 | *height: 13px; /* 3 */
445 | *width: 13px; /* 3 */
446 | }
447 |
448 | /*
449 | * 1. Addresses appearance set to searchfield in S5, Chrome
450 | * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
451 | */
452 |
453 | input[type="search"] {
454 | -webkit-appearance: textfield; /* 1 */
455 | -moz-box-sizing: content-box;
456 | -webkit-box-sizing: content-box; /* 2 */
457 | box-sizing: content-box;
458 | }
459 |
460 | /*
461 | * Removes inner padding and search cancel button in S5, Chrome on OS X
462 | */
463 |
464 | input[type="search"]::-webkit-search-decoration,
465 | input[type="search"]::-webkit-search-cancel-button {
466 | -webkit-appearance: none;
467 | }
468 |
469 | /*
470 | * Removes inner padding and border in FF3+
471 | * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
472 | */
473 |
474 | button::-moz-focus-inner,
475 | input::-moz-focus-inner {
476 | border: 0;
477 | padding: 0;
478 | }
479 |
480 | /*
481 | * 1. Removes default vertical scrollbar in IE6/7/8/9
482 | * 2. Improves readability and alignment in all browsers
483 | */
484 |
485 | textarea {
486 | overflow: auto; /* 1 */
487 | vertical-align: top; /* 2 */
488 | }
489 |
490 |
491 | /* =============================================================================
492 | Tables
493 | ========================================================================== */
494 |
495 | /*
496 | * Remove most spacing between table cells
497 | */
498 |
499 | table {
500 | border-collapse: collapse;
501 | border-spacing: 0;
502 | }
--------------------------------------------------------------------------------
/releases/enscroll-0.2.5.min.js:
--------------------------------------------------------------------------------
1 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(typeof client!=="undefined"&&client.engine.opera&&client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,T=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,Q,N,A,L,z,F,R,t,D,C,y,S,P,O,r={position:"absolute","z-index":1,margin:0,padding:0},w=function(U){m.call(B,U)},v=function(V,U){if(typeof U==="string"){d(V).html(U)}else{if(typeof U==="object"&&U!==null&&U.nodeType&&U.nodeType===1){V.appendChild(U)}}};if(p.verticalScrolling){K=o.createElement("div");Q=o.createElement("div");A=o.createElement("a");d(Q).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(Q);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(Q).on("click",function(U){if(U.target===this){i(I,U.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(Q);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(Q).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});P=parseInt(B.css("outline-width"),10);if((P===0||isNaN(P))&&B.css("outline-style")==="none"){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");N=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");R=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(R).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(U){if(U.target===this){l(I,U.pageX>d(N).offset().left?B.width():-B.width())}})}d(N).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(N,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){O=document.createElement("div");d(O).html(" ").css({height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}S=B.attr("tabindex");if(!S||S.length<1){B.attr("tabindex",0);s=false}y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(U){j.call(this,U)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:O,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(U){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(Q,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}})(jQuery,window,document);
--------------------------------------------------------------------------------
/releases/enscroll-0.2.6.min.js:
--------------------------------------------------------------------------------
1 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(typeof client!=="undefined"&&client.engine.opera&&client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q._fadeTimer){clearTimeout(q._fadeTimer)}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,T=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,Q,N,A,L,z,F,R,t,D,C,y,S,P,O,r={position:"absolute","z-index":1,margin:0,padding:0},w=function(U){m.call(B,U)},v=function(V,U){if(typeof U==="string"){d(V).html(U)}else{if(typeof U==="object"&&U!==null&&U.nodeType&&U.nodeType===1){V.appendChild(U)}}};if(p.verticalScrolling){K=o.createElement("div");Q=o.createElement("div");A=o.createElement("a");d(Q).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(Q);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(Q).on("click",function(U){if(U.target===this){i(I,U.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(Q);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(Q).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});P=parseInt(B.css("outline-width"),10);if((P===0||isNaN(P))&&B.css("outline-style")==="none"){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");N=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");R=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(R).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(U){if(U.target===this){l(I,U.pageX>d(N).offset().left?B.width():-B.width())}})}d(N).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(N,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){O=document.createElement("div");d(O).html(" ").css({height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}S=B.attr("tabindex");if(!S||S.length<1){B.attr("tabindex",0);s=false}y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(U){j.call(this,U)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:O,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(U){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(Q,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}})(jQuery,window,document);
--------------------------------------------------------------------------------
/js/script.js:
--------------------------------------------------------------------------------
1 | /*global $:false,_gaq:false,jQuery:false*/
2 |
3 | jQuery.browser = jQuery.browser || { msie: false };
4 |
5 | var enscroll = {
6 | loaded: false,
7 | fiddleLoaded: false,
8 | width: -1,
9 | docData: [
10 | {
11 | property: 'verticalScrolling',
12 | value: 'true',
13 | description: 'Whether to render the scrollbars on the right to scroll vertically when the content of the view pane has a height greater than the height of the view pane itself'
14 | }, {
15 | property: 'horizontalScrolling',
16 | value: 'false',
17 | description: 'Whether to render the scrollbars on the bottom to scroll horizontally when the content of the view pane has a width greater than the width of the view pane itself'
18 | }, {
19 | property: 'verticalScrollerSide',
20 | value: 'right',
21 | description: 'The vertical scrollbar can be rendered on the left side of the view pane when this property is set to the string value "left"'
22 | }, {
23 | property: 'showOnHover',
24 | value: 'false',
25 | description: 'When enabled, the scrollbar(s) will remain hidden until the user hovers the mouse cursor over the view pane. This feature is useful when creating a scrolling UI similar to Facebook’s ticker on the News Feed'
26 | }, {
27 | property: 'scrollIncrement',
28 | value: '40',
29 | description: 'The distance(in pixels) the view pane should scroll when using the mousewheel or arrow keys on the keyboard'
30 | }, {
31 | property: 'minScrollbarLength',
32 | value: '25',
33 | description: 'The length of the scrollbar handles will vary in length according to the size of the content in the view pane. This property specifies a minimum length(in pixels) beyond which the scrollbar will not contract'
34 | }, {
35 | property: 'pollChanges',
36 | value: 'true',
37 | description: 'Whether to listen for changes to the view pane including content being changed within the view pane, changes to the width and height of the view pane, and changes to the position of the view pane. If one of these changes is detected, the scrollbar(s) will be updated to reflect these new properties'
38 | }, {
39 | property: 'addPaddingToPane',
40 | value: 'true',
41 | description: 'The scrollbars are rendered over top of the view pane, and as a result, the plugin adds padding to the right of the view pane when verticalScrolling is enabled, and padding to the bottom when horizontalScrolling is enabled. Setting this option to false will prevent the plugin from adding the padding (added in v. 1.4.1)'
42 | }, {
43 | property: 'drawCorner',
44 | value: 'true',
45 | description: 'Whether to render a corner element at the bottom right of the view pane when both vertical and horizontal scrollbars are visible'
46 | }, {
47 | property: 'drawScrollButtons',
48 | value: 'false',
49 | description: 'Whether to render up and down scroll buttons above and below the vertical scrollbar. If the horizontal scrolling is enabled, left and right scroll buttons will be rendered to the left and right of the horizontal scrollbar'
50 | }, {
51 | property: 'clickTrackToScroll',
52 | value: 'true',
53 | description: 'If set to true, the view pane will scroll up a page when you click the track above the handle, and scroll down a page when you click the track below the handle'
54 | }, {
55 | property: 'propagateWheelEvent',
56 | value: 'true',
57 | description: 'Normally, scrolling the view pane to the top or bottom with the mouse wheel will cause the wheel event to propagate to its parent. Setting this property to false will prevent this behavior'
58 | }, {
59 | property: 'verticalTrackClass',
60 | value: '\'vertical-track\'',
61 | description: 'The CSS class name given to the track of the vertical scrollbar'
62 | }, {
63 | property: 'horizontalTrackClass',
64 | value: '\'horizontal-track\'',
65 | description: 'The CSS class name given to the track of the horizontal scrollbar'
66 | }, {
67 | property: 'verticalHandleClass',
68 | value: '\'vertical-handle\'',
69 | description: 'The CSS class name given to the handle of the vertical scrollbar'
70 | }, {
71 | property: 'horizontalHandleClass',
72 | value: '\'horizontal-handle\'',
73 | description: 'The CSS class name given to the handle of the horizontal scrollbar'
74 | }, {
75 | property: 'cornerClass',
76 | value: '\'scrollbar-corner\'',
77 | description: 'The CSS class name given to the corner element'
78 | }, {
79 | property: 'scrollUpButtonClass',
80 | value: '\'scroll-up-btn\'',
81 | description: 'The CSS class name given to the scroll up button above the vertical scrollbar track'
82 | }, {
83 | property: 'scrollDownButtonClass',
84 | value: '\'scroll-down-btn\'',
85 | description: 'The CSS class name given to the scroll down button below the vertical scrollbar track'
86 | }, {
87 | property: 'scrollLeftButtonClass',
88 | value: '\'scroll-left-btn\'',
89 | description: 'The CSS class name given to the scroll left button to the left of the horizontal scrollbar track'
90 | }, {
91 | property: 'scrollRightButtonClass',
92 | value: '\'scroll-right-btn\'',
93 | description: 'The CSS class name given to the scroll right button to the right of the horizontal scrollbar track'
94 | }, {
95 | property: 'zIndex',
96 | value: '1',
97 | description: 'The value of the z-index CSS property assigned to the parent element of each of the scrollbars'
98 | }, {
99 | property: 'easingDuration',
100 | value: '500',
101 | description: 'The amount of time in milliseconds the scroll animation takes to complete'
102 | }
103 | ],
104 |
105 | renderDocs: function() {
106 | var e = document.getElementById('doc-content'),
107 | tableTemplate = window.JST['templates/doc-table.handlebars'],
108 | listTemplate = window.JST['templates/doc-list.handlebars'];
109 |
110 | if ( e ) {
111 | e.innerHTML = tableTemplate(enscroll.docData) +
112 | listTemplate(enscroll.docData);
113 | }
114 | },
115 |
116 | changeTab: function() {
117 | var hash = location.hash.toLowerCase(),
118 | section = null,
119 | init = function() {
120 | var url, iframe;
121 |
122 | $( '.folder-content' )
123 | .css( 'min-height', $( '.folder-content' ).find( 'section:visible' ).height() );
124 |
125 | if ( hash === 'try-it-now' ) {
126 | enscroll.fiddleLoaded = enscroll.fiddleLoaded || (function() {
127 | url = 'http://jsfiddle.net/jstoudt/PGuB5/';
128 | iframe = $( '#try-it-now-section' ).find( 'iframe' )[0];
129 | if ( !iframe.src || iframe.src !== url ) {
130 | iframe.src = url;
131 | }
132 | return true;
133 | }());
134 | }
135 |
136 | if ( hash === 'demos' ) {
137 | enscroll.loadDemos();
138 | }
139 |
140 | };
141 |
142 | if ( hash.charAt(0) === '#' ) {
143 | hash = hash.substring( 1 );
144 | }
145 |
146 | switch( hash ) {
147 | case 'features':
148 | case 'documentation':
149 | case 'demos':
150 | case 'try-it-now':
151 | break;
152 | default:
153 | hash = 'overview';
154 | }
155 |
156 | $( '.folder-tabs' ).find( 'a' ).removeClass( 'selected' );
157 | $( '.folder-tabs' ).find( '[rel="' + hash + '"]' ).addClass( 'selected' );
158 |
159 | if ( enscroll.loaded ) {
160 | $( '.folder-content' ).find( 'section:visible' ).stop().fadeOut( 'fast', function() {
161 | $( '#' + hash + '-section' ).stop().fadeIn( 'fast', function() {
162 | init();
163 | } );
164 | } );
165 | } else {
166 | $( '.folder-content' ).find( 'section' ).css( 'display', 'none' );
167 |
168 | section = document.getElementById( hash + '-section' );
169 | if ( section ) {
170 | section.style.display = 'block';
171 | }
172 | init();
173 | enscroll.loaded = true;
174 | }
175 | },
176 |
177 | loadDemos: function() {
178 | $( '.scrollpane' ).enscroll( 'destroy' );
179 |
180 | $( '#scrollpane1' ).enscroll({
181 | verticalTrackClass: 'track1',
182 | verticalHandleClass: 'handle1',
183 | drawScrollButtons: true,
184 | scrollUpButtonClass: 'scroll-up1',
185 | scrollDownButtonClass: 'scroll-down1'
186 | });
187 |
188 | $( '#scrollpane2' ).enscroll({
189 | horizontalScrolling: true,
190 | verticalTrackClass: 'track2-vertical',
191 | verticalHandleClass: 'handle2-vertical',
192 | horizontalTrackClass: 'track2-horizontal',
193 | horizontalHandleClass: 'handle2-horizontal',
194 | cornerClass: 'corner2'
195 | });
196 |
197 | $( '#scrollpane3' ).enscroll({
198 | showOnHover: true,
199 | verticalTrackClass: 'track3',
200 | verticalHandleClass: 'handle3'
201 | });
202 |
203 | $( '#scrollpane4' ).enscroll({
204 | verticalTrackClass: 'track4',
205 | verticalHandleClass: 'handle4',
206 | minScrollbarLength: 28,
207 | zIndex: 5,
208 | addPaddingToPane: false
209 | });
210 | },
211 |
212 | resize: function() {
213 | var width = document.compatMode === 'CSS1Compat' && document.clientWidth ? document.clientWidth :
214 | document.body.clientWidth,
215 | toSmallSrc = function() {
216 | $( 'img[data-small]' ).each(function() {
217 | var $this = $( this ),
218 | largeSrc = $this.attr( 'src' );
219 | $this.attr({
220 | 'src': $this.attr( 'data-small' ),
221 | 'data-large': largeSrc
222 | });
223 | $this.removeAttr( 'data-small' );
224 | } );
225 | },
226 | toLargeSrc = function() {
227 | $( 'img[data-large]' ).each( function() {
228 | var $this = $( this ),
229 | smallSrc = $this.attr( 'src' );
230 | $this.attr({
231 | 'src': $this.attr( 'data-large' ),
232 | 'data-small': smallSrc
233 | });
234 | $this.removeAttr( 'data-large' );
235 | } );
236 | };
237 |
238 | if ( width < 768 && enscroll.width >= 768 ||
239 | width >= 768 && enscroll.width < 768 ||
240 | width < 480 && enscroll.width >= 480 ||
241 | width >= 480 && enscroll.width < 480 ||
242 | enscroll.width < 1 ) {
243 |
244 | enscroll.loadDemos();
245 | if ( width >= 768 ) {
246 | enscroll.loaded = false;
247 | enscroll.changeTab();
248 | toLargeSrc();
249 | } else {
250 | (function() {
251 | var i = 0,
252 | ids = [
253 | 'overview',
254 | 'features',
255 | 'documentation',
256 | 'demos',
257 | 'overview-section',
258 | 'features-section',
259 | 'documentation-section',
260 | 'demos-section'
261 | ],
262 | l = ids.length;
263 |
264 | for (; i < l; i++ ) {
265 | $( ids[ i ]).css( 'display', 'block' );
266 | }
267 |
268 | $( '#try-it-now-section' ).css( 'display', 'none' );
269 |
270 | toSmallSrc();
271 | }());
272 | }
273 | }
274 |
275 | enscroll.width = width;
276 | },
277 |
278 | trackClickEvent: function( elem, category, action ) {
279 | $( elem ).click( function() {
280 | _gaq.push([ '_trackEvent', category, action ]);
281 | });
282 | }
283 | };
284 |
285 | $( function() {
286 | enscroll.renderDocs();
287 |
288 | if ( window.addEventListener ) {
289 | window.addEventListener( 'hashchange', enscroll.changeTab, false );
290 | } else if ( window.attachEvent ) {
291 | window.attachEvent( 'onhashchange', enscroll.changeTab );
292 | }
293 |
294 | $( window ).resize( enscroll.resize );
295 | if ( window.addEventListener ) {
296 | window.addEventListener( 'orientationchange', enscroll.resize, false );
297 | }
298 | enscroll.resize();
299 |
300 | $( '#scroll-to-top' ).click( function() {
301 | window.scroll( 0, 0 );
302 | return false;
303 | });
304 |
305 | $( 'a[data-tab-link]' ).click( function() {
306 | var href = this.href,
307 | delta = 10,
308 | cabinetY = Math.round( $( '.cabinet' ).offset().top ) - 20,
309 | prevCurY = -1,
310 | reqAnimFrame = window.requestAnimationFrame ||
311 | window.mozRequestAnimationFrame ||
312 | window.webkitRequestAnimationFrame ||
313 | window.msRequestAnimationFrame ||
314 | function(f) { setTimeout( f, 1000 / 60 ); };
315 |
316 | ( function scrollWindow() {
317 | var curY = typeof window.pageYOffset === 'number' ? window.pageYOffset :
318 | document.documentElement ? document.documentElement.scrollTop :
319 | document.body.scrollTop;
320 |
321 | if ( curY === cabinetY || curY === prevCurY ) {
322 | window.location = href;
323 | } else {
324 | delta = Math.min( ++delta, Math.abs( curY - cabinetY ) );
325 | window.scroll( 0, curY < cabinetY ? curY + delta : curY - delta );
326 | prevCurY = curY;
327 | reqAnimFrame(scrollWindow);
328 | }
329 | }());
330 |
331 | return false;
332 | });
333 |
334 | $( '.view-code' ).overlay({
335 | effect: 'apple',
336 | mask: {
337 | color: '#000',
338 | opacity: 0.85
339 | },
340 | onLoad: function( event ) {
341 | var iframe = $( event.target.rel ).find( 'iframe' )[0];
342 | if ( iframe && !iframe.src ) {
343 | iframe.src = event.target.href;
344 | }
345 | }
346 | });
347 |
348 | if ($('#twitter-share-button').length) {
349 | // Script necessary for the tweet button
350 | (function(d,s,id){
351 | var js,
352 | fjs=d.getElementsByTagName(s)[0];
353 | if(!d.getElementById(id)) {
354 | js=d.createElement(s);
355 | js.id=id;
356 | js.src='//platform.twitter.com/widgets.js';
357 | fjs.parentNode.insertBefore(js,fjs);
358 | }
359 | }(document,'script','twitter-wjs'));
360 | }
361 |
362 | if ($('#g-plusone').length) {
363 | // Script needed for the Google +1 button
364 | (function() {
365 | var po = document.createElement('script');
366 | po.async = true;
367 | po.src = 'https://apis.google.com/js/plusone.js';
368 | var s = document.getElementsByTagName('script')[0];
369 | s.parentNode.insertBefore(po, s);
370 | }());
371 | }
372 |
373 | // Google Analytics click handler bindings
374 | var navElems = {
375 | 'site-logo': 'Site Logo',
376 | 'demo-btn': 'Demo Button',
377 | 'overview-tab': 'Overview Tab',
378 | 'features-tab': 'Features Tab',
379 | 'documentation-tab': 'Documentation Tab',
380 | 'demos-tab': 'Demos Tab',
381 | 'try-it-now-tab': 'Try It Now Tab'
382 | };
383 |
384 | for ( var attr in navElems ) {
385 | if ( navElems.hasOwnProperty(attr) ) {
386 | enscroll.trackClickEvent( document.getElementById( attr ),
387 | 'Navigation', navElems[attr] );
388 | }
389 | }
390 |
391 | var downloadBtn = document.getElementById( 'download-btn' );
392 | enscroll.trackClickEvent( downloadBtn, 'Download',
393 | $( downloadBtn ).data( 'action' ) );
394 | });
395 |
--------------------------------------------------------------------------------
/releases/enscroll-0.2.8.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * enscroll.js - jQuery plugin to add custom scrollbars to HTML block elements
3 | * Copyright (C) 2012 Jason T. Stoudt
4 | * Released under the MIT license
5 | * http://enscrollplugin.com/license.html
6 | **/
7 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(t).removeClass("dragging");d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;d(s).removeClass("dragging");o.body.style.cursor=E;this.style.cursor="";d(s).removeClass("dragging");d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(window.client&&window.client.engine.opera&&window.client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q._fadeTimer){clearTimeout(q._fadeTimer)}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,T=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,Q,N,A,L,z,F,R,t,D,C,y,S,P,O,r={position:"absolute","z-index":1,margin:0,padding:0},w=function(U){m.call(B,U)},v=function(V,U){if(typeof U==="string"){d(V).html(U)}else{if(typeof U==="object"&&U!==null&&U.nodeType&&U.nodeType===1){V.appendChild(U)}}};if(p.verticalScrolling){K=o.createElement("div");Q=o.createElement("div");A=o.createElement("a");d(Q).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(Q);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(Q).on("click",function(U){if(U.target===this){i(I,U.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(Q);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(Q).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});P=parseInt(B.css("outline-width"),10);if((P===0||isNaN(P))&&B.css("outline-style")==="none"){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");N=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");R=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(R).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(U){if(U.target===this){l(I,U.pageX>d(N).offset().left?B.width():-B.width())}})}d(N).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(N,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){O=document.createElement("div");d(O).html(" ").css({height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}S=B.attr("tabindex");if(!S||S.length<1){B.attr("tabindex",0);s=false}y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(U){j.call(this,U)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:O,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(U){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(Q,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}}(jQuery,window,document));
8 |
--------------------------------------------------------------------------------
/releases/enscroll-0.2.9.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * enscroll.js - jQuery plugin to add custom scrollbars to HTML block elements
3 | * Copyright (C) 2012 Jason T. Stoudt
4 | * Released under the MIT license
5 | * http://enscrollplugin.com/license.html
6 | **/
7 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(t).removeClass("dragging");d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;d(s).removeClass("dragging");o.body.style.cursor=E;this.style.cursor="";d(s).removeClass("dragging");d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(window.client&&window.client.engine.opera&&window.client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q._fadeTimer){clearTimeout(q._fadeTimer)}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,U=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,R,O,A,L,z,F,S,t,D,C,y,T,Q,P,r={position:"absolute","z-index":p.zIndex,margin:0,padding:0},w=function(V){m.call(B,V)},v=function(W,V){if(typeof V==="string"){d(W).html(V)}else{if(typeof V==="object"&&V!==null&&V.nodeType&&V.nodeType===1){W.appendChild(V)}}};if(p.verticalScrolling){K=o.createElement("div");R=o.createElement("div");A=o.createElement("a");d(R).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(R);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(R).on("click",function(V){if(V.target===this){i(I,V.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(R);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(R).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});try{Q=parseInt(B.css("outline-width"),10);if((Q===0||isNaN(Q))&&B.css("outline-style")==="none"){B.css("outline","none")}}catch(N){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");O=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");S=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(S).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(V){if(V.target===this){l(I,V.pageX>d(O).offset().left?B.width():-B.width())}})}d(O).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(O,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){P=document.createElement("div");d(P).html(" ").css({height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}T=B.attr("tabindex");if(!T||T.length<1){B.attr("tabindex",0);s=false}try{y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}}catch(N){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(V){j.call(this,V)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:P,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(V){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(R,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}}(jQuery,window,document));
8 |
--------------------------------------------------------------------------------
/releases/enscroll-0.2.2.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | enscroll.js - jQuery plugin to add custom scrollbars HTML block elements
3 | Copyright (C) 2012 Jason T. Stoudt
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | **/
19 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=(r.detail)?-r.detail:(typeof client!=="undefined"&&client.engine.opera&&client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;E.style.display="none";if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";E.style.display="block"}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(d(this).css("overflow")!=="auto"||!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,S=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,P,N,A,L,z,F,Q,t,D,C,y,R,O,r={position:"absolute","z-index":1,margin:0,padding:0},w=function(T){m.call(B,T)},v=function(U,T){if(typeof T==="string"){d(U).html(T)}else{if(typeof T==="object"&&T!==null&&T.nodeType&&T.nodeType===1){U.appendChild(T)}}};if(p.verticalScrolling){K=o.createElement("div");P=o.createElement("div");A=o.createElement("a");d(P).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(P);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(P).on("click",function(T){if(T.target===this){i(I,T.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(P);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)})}D=d(P).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"})}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");N=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");Q=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(Q).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(T){if(T.target===this){l(I,T.pageX>d(N).offset().left?B.width():-B.width())}})}d(N).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(N,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});O=document.createElement("div");d(O).html(" ").css({height:"1px",padding:0,margin:0}).appendTo(this)}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}R=B.attr("tabindex");if(!R||R.length<1){B.attr("tabindex",0);s=false}y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(T){j.call(this,T)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:O,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(T){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(P,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}})(jQuery,window,document);
--------------------------------------------------------------------------------
/releases/enscroll-0.3.0.min.js:
--------------------------------------------------------------------------------
1 | (function(e,f){if(!e.browser){var c={},d=navigator.userAgent.toLowerCase(),b=/(chrome)[ \/]([\w.]+)/.exec(d)||/(webkit)[ \/]([\w.]+)/.exec(d)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(d)||/(msie) ([\w.]+)/.exec(d)||d.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(d)||[],a={browser:b[1]||"",version:b[2]||0};if(a.browser){c[a.browser]=true;c.version=a.version}if(c.chrome){c.webkit=true}else{if(c.webkit){c.safari=true}}e.browser=c}}(jQuery));(function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(t).removeClass("dragging");d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;d(s).removeClass("dragging");o.body.style.cursor=E;this.style.cursor="";d(s).removeClass("dragging");d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(window.client&&window.client.engine.opera&&window.client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q._fadeTimer){clearTimeout(q._fadeTimer)}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,U=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,R,O,A,L,z,F,S,t,D,C,y,T,Q,P,r={position:"absolute","z-index":p.zIndex,margin:0,padding:0},w=function(V){m.call(B,V)},v=function(W,V){if(typeof V==="string"){d(W).html(V)}else{if(typeof V==="object"&&V!==null&&V.nodeType&&V.nodeType===1){W.appendChild(V)}}};if(p.verticalScrolling){K=o.createElement("div");R=o.createElement("div");A=o.createElement("a");d(R).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(R);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(R).on("click",function(V){if(V.target===this){i(I,V.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(R);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(R).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});try{Q=parseInt(B.css("outline-width"),10);if((Q===0||isNaN(Q))&&B.css("outline-style")==="none"){B.css("outline","none")}}catch(N){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");O=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");S=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(S).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(V){if(V.target===this){l(I,V.pageX>d(O).offset().left?B.width():-B.width())}})}d(O).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(O,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){P=document.createElement("div");d(P).css({width:"1px",height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}T=B.attr("tabindex");if(!T||T.length<1){B.attr("tabindex",0);s=false}try{y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}}catch(N){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(V){j.call(this,V)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:P,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(V){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(R,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}}(jQuery,window,document));
--------------------------------------------------------------------------------
/releases/enscroll-0.2.4.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | enscroll.js - jQuery plugin to add custom scrollbars HTML block elements
3 | Copyright (C) 2012 Jason T. Stoudt
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License
7 | as published by the Free Software Foundation; either version 2
8 | of the License, or (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | **/
19 | (function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=(r.detail)?-r.detail:(typeof client!=="undefined"&&client.engine.opera&&client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(t){var q,p,r=null,u=function(w){var z=d(this),v=q,x=p,A=z.scrollLeft(),y=z.scrollTop();q=w.touches[0].clientX;p=w.touches[0].clientY;if(r===null){r=Math.abs(x-p)>Math.abs(v-q)?"y":"x"}if(r==="y"){i(this,x-p)}else{l(this,v-q)}if(y!==z.scrollTop()||A!==z.scrollLeft()){w.preventDefault()}},s=function(){this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",s,false)};if(t.touches.length===1){q=t.touches[0].clientX;p=t.touches[0].clientY;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",s,false)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,S=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,P,N,A,L,z,F,Q,t,D,C,y,R,O,r={position:"absolute","z-index":1,margin:0,padding:0},w=function(T){m.call(B,T)},v=function(U,T){if(typeof T==="string"){d(U).html(T)}else{if(typeof T==="object"&&T!==null&&T.nodeType&&T.nodeType===1){U.appendChild(T)}}};if(p.verticalScrolling){K=o.createElement("div");P=o.createElement("div");A=o.createElement("a");d(P).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(P);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(P).on("click",function(T){if(T.target===this){i(I,T.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(P);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(P).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"})}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");N=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");Q=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(Q).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(T){if(T.target===this){l(I,T.pageX>d(N).offset().left?B.width():-B.width())}})}d(N).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(N,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){O=document.createElement("div");d(O).html(" ").css({height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}R=B.attr("tabindex");if(!R||R.length<1){B.attr("tabindex",0);s=false}y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(T){j.call(this,T)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:O,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(T){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(P,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}})(jQuery,window,document);
--------------------------------------------------------------------------------
/releases/enscroll-0.4.1.min.js:
--------------------------------------------------------------------------------
1 | /*! enscroll - v0.4.1 - 2013-08-22
2 | * Copyright (c) 2013 ; Licensed */
3 | !function(a){if(!a.browser){var b={},c=navigator.userAgent.toLowerCase(),d=/(chrome)[ \/]([\w.]+)/.exec(c)||/(webkit)[ \/]([\w.]+)/.exec(c)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(c)||/(msie) ([\w.]+)/.exec(c)||c.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(c)||[],e={browser:d[1]||"",version:d[2]||0};e.browser&&(b[e.browser]=!0,b.version=e.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),a.browser=b}}(jQuery),function(a,b,c){var d={getEvent:function(a){return a||b.event},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1}},e=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,1e3/60)},f=function(b){var c=a(this).data("enscroll"),d=this,e=c.settings,f=function(){var b=a(this).data("enscroll"),c=b.settings;b&&c.showOnHover&&(c.verticalScrolling&&"none"!==a(b.verticalTrackWrapper).css("display"),c.horizontalScrolling&&"none"!==a(b.horizontalTrackWrapper).css("display")&&a(b.horizontalTrackWrapper).stop().fadeTo("fast",0),b._fadeTimer=null)};c&&e.showOnHover&&(c._fadeTimer?clearTimeout(c._fadeTimer):(e.verticalScrolling&&"none"!==a(c.verticalTrackWrapper).css("display")&&a(c.verticalTrackWrapper).stop().fadeTo("fast",1),e.horizontalScrolling&&"none"!==a(c.horizontalTrackWrapper).css("display")&&a(c.horizontalTrackWrapper).stop().fadeTo("fast",1)),b!==!1&&(c._fadeTimer=setTimeout(function(){f.call(d)},1500)))},g=function(b,c){var d=a(b),e=d.data("enscroll"),g=d.scrollTop();e&&e.settings.verticalScrolling&&(d.scrollTop(g+c),e.settings.showOnHover&&f.call(b))},h=function(b,c){var d=a(b),e=d.data("enscroll"),g=d.scrollLeft();e&&e.settings.horizontalScrolling&&(d.scrollLeft(g+c),e.settings.showOnHover&&f.call(b))},i=function(b){if(1===b.which){var d,g,h,i,j,k,l,m,n,o=b.data.pane,p=a(o).data("enscroll"),q=!0,r=function(){q&&(h!==i&&(a(o).scrollTop(h*n/m),i=h),e(r),f.call(o))},s=function(a){return q&&(h=a.clientY-k-j,h=Math.min(0>h?0:h,m)),!1},t=function(){return q=!1,c.body.style.cursor=l,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical"),a(c).off("mouseout.enscroll.vertical"),!1};return d=a(p.verticalTrackWrapper).find(".enscroll-track"),g=d.children().first()[0],h=parseInt(g.style.top,10),n=o.scrollHeight-a(o).innerHeight(),j=b.clientY-a(g).offset().top,m=d.height()-a(g).outerHeight(),k=d.offset().top,a(c.body).on({"mousemove.enscroll.vertical":s,"mouseup.enscroll.vertical":function(a){t.call(g,a)}}),a(c).on("mouseout.enscroll.vertical",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&t.call(g,a)}),d.hasClass("dragging")||(d.addClass("dragging"),l=a(c.body).css("cursor"),this.style.cursor=c.body.style.cursor="ns-resize"),r(),!1}},j=function(b){if(1===b.which){var d,g,h,i,j,k,l,m,n,o=b.data.pane,p=a(o).data("enscroll"),q=!0,r=function(){q&&(h!==i&&(a(o).scrollLeft(h*j/n),i=h),e(r),f.call(o))},s=function(a){return q&&(h=a.clientX-l-k,h=Math.min(0>h?0:h,n),f.call(o)),!1},t=function(){return q=!1,d.removeClass("dragging"),c.body.style.cursor=m,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal"),a(c).off("mouseout.enscroll.horizontal"),!1};return d=a(p.horizontalTrackWrapper).find(".enscroll-track"),g=d.children().first()[0],h=parseInt(g.style.left,10),j=o.scrollWidth-a(o).innerWidth(),k=b.clientX-a(g).offset().left,n=d.width()-a(g).outerWidth(),l=d.offset().left,a(c.body).on({"mousemove.enscroll.horizontal":s,"mouseup.enscroll.horizontal":function(a){t.call(g,a)}}),a(c).on("mouseout.enscroll.horizontal",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&t.call(g,a)}),d.hasClass("dragging")||(d.addClass("dragging"),m=a("body").css("cursor"),this.style.cursor=c.body.style.cursor="ew-resize"),r(),!1}},k=function(a){var b,c,e,f,i=this.data("enscroll");i&&(a=d.getEvent(a),e=a.detail?-a.detail:window.client&&window.client.engine.opera&&window.client.engine.opera<9.5?-a.wheelDelta:a.wheelDelta,f=i.settings.scrollIncrement,a.wheelDelta&&a.wheelDeltaX&&a.wheelDelta===a.wheelDeltaX||a.axis&&a.HORIZONTAL_AXIS&&a.axis===a.HORIZONTAL_AXIS?(b=this.scrollLeft(),h(this,0>e?f:-f),b!==this.scrollLeft()&&d.preventDefault(a)):(c=this.scrollTop(),g(this,0>e?f:-f),c!==this.scrollTop()&&d.preventDefault(a)))},l=function(){var b,c,d,e=a(this),f=e.data("enscroll");f&&(f.settings.verticalScrolling&&(c=a(f.verticalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollTop()/(this.scrollHeight-e.innerHeight()),d=isNaN(d)?0:d,b.style.top=d*(a(c).height()-a(b).outerHeight())+"px"),f.settings.horizontalScrolling&&(c=a(f.horizontalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollLeft()/(this.scrollWidth-e.innerWidth()),d=isNaN(d)?0:d,b.style.left=d*(a(c).width()-a(b).innerWidth())+"px"))},m=function(b){var c,d=a(this),e=d.data("enscroll");if(b.target===this&&e){switch(c=e.settings.scrollIncrement,b.keyCode){case 32:case 34:return g(this,d.height()),!1;case 33:return g(this,-d.height()),!1;case 35:return g(this,this.scrollHeight),!1;case 36:return g(this,-this.scrollHeight),!1;case 37:return h(this,-c),!1;case 38:return g(this,-c),!1;case 39:return h(this,c),!1;case 40:return g(this,c),!1}return!0}},n=function(a){var b,c,d,f,i,j,k,l=this,m=function(a){b=a.touches[0].clientX,c=a.touches[0].clientY,d||(d=c===i&&b===f?void 0:Math.abs(i-c)>Math.abs(f-b)?"y":"x"),a.preventDefault()},n=function(){j&&("y"===d?(g(l,i-c),k=i-c,i=c):"x"===d&&(h(l,f-b),k=f-b,f=b),e(n))},o=function(){var a=0,b=Math.round(Math.abs(1.75*k)),c=10*k*Math.log(2);this.removeEventListener("touchmove",m,!1),this.removeEventListener("touchend",o,!1),j=!1,e(function f(){if(a!==b&&!j){var i=Math.round(c/b*Math.pow(2,-10*a/b+1));isNaN(i)||0===i||(a+=1,"y"===d?g(l,i):h(l,i),e(f))}})};1===a.touches.length&&(f=a.touches[0].clientX,i=a.touches[0].clientY,j=!0,this.addEventListener("touchmove",m,!1),this.addEventListener("touchend",o,!1),e(n))},o={reposition:function(){return this.each(function(){var b,c,d,e,f,g=a(this),h=g.data("enscroll"),i=function(a,b,c){a.style.left=b+"px",a.style.top=c+"px"},j=function(b,c){var d=a(b).css(c),e=/^-?\d+/.exec(d);return e?+e[0]:0};h&&(d=g.position(),f=a.browser.msie&&/^6/.test(a.browser.version),f&&(e=g.offsetParent()[0]),b=h.corner,h.settings.verticalScrolling&&(c=h.verticalTrackWrapper,i(c,d.left+g.outerWidth()-a(c).width()-j(this,"border-right-width")-(f?j(e,"padding-left"):0),d.top+j(this,"border-top-width")+(f?j(e,"border-top-width"):0))),h.settings.horizontalScrolling&&(c=h.horizontalTrackWrapper,i(c,d.left+j(this,"border-left-width")-(f?j(e,"padding-left"):0),d.top+g.outerHeight()-a(c).height()-j(this,"border-bottom-width")+(f?j(e,"border-bottom-width"):0))),b&&i(b,d.left+g.outerWidth()-a(b).outerWidth()-j(this,"border-right-width")-(f?j(e,"padding-left"):0),d.top+g.outerHeight()-a(b).outerHeight()-j(this,"border-bottom-width")+(f?j(e,"border-bottom-width"):0)))})},resize:function(){return this.each(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=a(this),s=r.data("enscroll");r.is(":visible")&&s&&(b=s.settings,b.verticalScrolling&&(e=s.verticalTrackWrapper,c=r.innerHeight(),f=c/this.scrollHeight,g=a(e).find(".enscroll-track")[0],j=a(e).find("."+b.scrollUpButtonClass),k=a(e).find("."+b.scrollDownButtonClass),i=b.horizontalScrolling?c-a(s.horizontalTrackWrapper).find(".enscroll-track").outerHeight():c,i-=a(g).outerHeight()-a(g).height()+j.outerHeight()+k.outerHeight(),n=g.firstChild,p=Math.max(f*i,b.minScrollbarLength),p-=a(n).outerHeight()-a(n).height(),e.style.display="none",g.style.height=i+"px",n.style.height=p+"px",1>f&&(f=r.scrollTop()/(this.scrollHeight-r.height()),n.style.top=f*(i-p)+"px",e.style.display="block")),b.horizontalScrolling&&(e=s.horizontalTrackWrapper,d=r.innerWidth(),f=d/this.scrollWidth,g=a(e).find(".enscroll-track")[0],l=a(e).find("."+b.scrollLeftButtonClass),m=a(e).find("."+b.scrollRightButtonClass),h=b.verticalScrolling?d-a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth():d,h-=a(g).outerWidth()-a(g).width()+l.outerWidth()+m.outerWidth(),n=g.firstChild,o=Math.max(f*h,b.minScrollbarLength),o-=a(n).outerWidth()-a(n).width(),e.style.display="none",g.style.width=h+"px",n.style.width=o+"px",1>f&&(f=r.scrollLeft()/(this.scrollWidth-r.width()),n.style.left=f*(h-o)+"px",e.style.display="block"),s._prybar&&(q=s._prybar,this.removeChild(q),b.verticalScrolling&&(q.style.width=this.scrollWidth+a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth()+"px",this.appendChild(q)))),s.corner&&(s.corner.style.display=s.verticalTrackWrapper&&s.horizontalTrackWrapper&&a(s.verticalTrackWrapper).is(":visible")&&a(s.horizontalTrackWrapper).is(":visible")?"block":"none"))})},startPolling:function(){return this.each(function(){var b,c=a(this).data("enscroll"),d=this,e=a(d),f=-1,g=-1,h=-1,i=-1,j=function(){if(c.settings.pollChanges){var a=d.scrollWidth,k=d.scrollHeight,l=e.width(),m=e.height(),n=e.offset();(c.settings.verticalScrolling&&(m!==g||k!==i)||c.settings.horizontalScrolling&&(l!==f||a!==h))&&(h=a,i=k,o.resize.call(e)),(b.left!==n.left||b.top!==n.top||l!==f||m!==g)&&(b=n,f=l,g=m,o.reposition.call(e)),setTimeout(j,350)}};c&&(c.settings.pollChanges=!0,i=d.scrollHeight,h=d.scrollWidth,b=e.offset(),j())})},stopPolling:function(){return this.each(function(){var b=a(this).data("enscroll");b&&(b.settings.pollChanges=!1)})},destroy:function(){return this.each(function(){var c,d,e=a(this),f=e.data("enscroll");f&&(o.stopPolling.call(e),d=f._mouseScrollHandler,f.settings.verticalScrolling&&(c=f.verticalTrackWrapper,a(c).remove(),c=null),f.settings.horizontalScrolling&&(c=f.horizontalTrackWrapper,a(c).remove(),c=null),f._fadeTimer&&clearTimeout(f._fadeTimer),f.corner&&a(f.corner).remove(),f._prybar&&f._prybar.parentNode&&f._prybar.parentNode===this&&a(f._prybar).remove(),this.setAttribute("style",f._style||""),f._hadTabIndex||e.removeAttr("tabindex"),e.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null),this.removeEventListener?(this.removeEventListener("mousewheel",d,!1),this.removeEventListener("DOMMouseScroll",d,!1),this.removeEventListener("touchstart",n,!1)):this.detachEvent&&this.detachEvent("onmousewheel",d),a(b).off("resize.enscroll.window"))})}};a.fn.enscroll=function(d){if(o[d])return o[d].call(this);var e=a.extend({verticalScrolling:!0,horizontalScrolling:!1,showOnHover:!1,scrollIncrement:20,minScrollbarLength:40,pollChanges:!0,drawCorner:!0,drawScrollButtons:!1,clickTrackToScroll:!0,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,addPaddingToPane:!0,horizontalHandleHTML:'
',verticalHandleHTML:'
'},d);return this.each(function(){if(e.verticalScrolling||e.horizontalScrolling){var d,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=a(this),G=this,H=F.attr("style"),I=!0,J={position:"absolute","z-index":e.zIndex,margin:0,padding:0},K=function(a){k.call(F,a)},L=function(b,c){"string"==typeof c?a(b).html(c):"object"==typeof c&&null!==c&&c.nodeType&&1===c.nodeType&&b.appendChild(c)};if(e.verticalScrolling){p=c.createElement("div"),r=c.createElement("div"),t=c.createElement("a"),a(r).css("position","relative").addClass("enscroll-track").addClass(e.verticalTrackClass).appendTo(p),e.drawScrollButtons&&(u=c.createElement("a"),v=c.createElement("a"),a(u).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(e.scrollUpButtonClass).on("click",function(){return g(G,-e.scrollIncrement),!1}).insertBefore(r),a(v).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){return g(G,e.scrollIncrement),!1}).addClass(e.scrollDownButtonClass).appendTo(p)),e.clickTrackToScroll&&a(r).on("click",function(b){b.target===this&&g(G,b.pageY>a(t).offset().top?F.height():-F.height())}),a(t).css({position:"absolute","z-index":1}).attr("href","").addClass(e.verticalHandleClass).mousedown({pane:this},i).click(function(){return!1}).appendTo(r),L(t,e.verticalHandleHTML),a(p).css(J).insertAfter(this),e.showOnHover&&a(p).css("opacity",0).on("mouseover.enscroll.vertical",function(){f.call(G,!1)}).on("mouseout.enscroll.vertical",function(){f.call(G)}),z=a(r).outerWidth(),e.addPaddingToPane&&F.css({width:F.width()-z+"px","padding-right":parseInt(F.css("padding-right"),10)+z+"px"});try{D=parseInt(F.css("outline-width"),10),0!==D&&!isNaN(D)||"none"!==F.css("outline-style")||F.css("outline","none")}catch(M){F.css("outline","none")}}e.horizontalScrolling&&(d=c.createElement("div"),q=c.createElement("div"),s=c.createElement("a"),a(q).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(e.horizontalTrackClass).appendTo(d),e.drawScrollButtons&&(w=c.createElement("a"),x=c.createElement("a"),a(w).css("display","block").attr("href","").on("click",function(){return h(G,-e.scrollIncrement),!1}).addClass(e.scrollLeftButtonClass).insertBefore(q),a(x).css("display","block").attr("href","").on("click",function(){return h(G,e.scrollIncrement),!1}).addClass(e.scrollRightButtonClass).appendTo(d)),e.clickTrackToScroll&&a(q).on("click",function(b){b.target===this&&h(G,b.pageX>a(s).offset().left?F.width():-F.width())}),a(s).css({position:"absolute","z-index":1}).attr("href","").addClass(e.horizontalHandleClass).click(function(){return!1}).mousedown({pane:this},j).appendTo(q),L(s,e.horizontalHandleHTML),a(d).css(J).insertAfter(this),e.showOnHover&&a(d).css("opacity",0).on("mouseover.enscroll.horizontal",function(){f.call(G,!1)}).on("mouseout.enscroll.horizontal",function(){f.call(G)}),y=a(q).outerHeight(),e.addPaddingToPane&&F.css({height:F.height()-y+"px","padding-bottom":parseInt(F.css("padding-bottom"),10)+y+"px"}),(!a.browser.msie||a.browser.msie&&a.browser.version>7)&&(E=document.createElement("div"),a(E).css({width:"1px",height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this))),e.verticalScrolling&&e.horizontalScrolling&&e.drawCorner&&(A=c.createElement("div"),a(A).addClass(e.cornerClass).css(J).insertAfter(this)),C=F.attr("tabindex"),(!C||C.length<1)&&(F.attr("tabindex",0),I=!1);try{B=F.css("outline"),(!B||B.length<1)&&F.css("outline","none")}catch(M){F.css("outline","none")}F.on({"scroll.enscroll.pane":function(a){l.call(this,a)},"keydown.enscroll.pane":m}).css("overflow","hidden").data("enscroll",{settings:e,horizontalTrackWrapper:d,verticalTrackWrapper:p,corner:A,_prybar:E,_mouseScrollHandler:K,_hadTabIndex:I,_style:H}),a(b).on("resize.enscroll.window",function(){o.reposition.call(F)}),e.showOnHover&&F.on("mouseenter.enscroll.pane",function(){f.call(this)}),this.addEventListener?(this.addEventListener("mousewheel",K,!1),this.addEventListener("DOMMouseScroll",K,!1),this.addEventListener("touchstart",n,!1)):this.attachEvent&&this.attachEvent("onmousewheel",K),e.pollChanges?o.startPolling.call(F):(o.resize.call(F),o.reposition.call(F)),a(r,q).removeClass(e.verticalTrackClass).addClass(e.verticalTrackClass)}})}}(jQuery,window,document);
--------------------------------------------------------------------------------
/releases/enscroll-0.4.2.min.js:
--------------------------------------------------------------------------------
1 | /*! enscroll - v0.4.2 - 2013-08-29
2 | * Copyright (c) 2013 ; Licensed */
3 | !function(a){if(!a.browser){var b={},c=navigator.userAgent.toLowerCase(),d=/(chrome)[ \/]([\w.]+)/.exec(c)||/(webkit)[ \/]([\w.]+)/.exec(c)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(c)||/(msie) ([\w.]+)/.exec(c)||c.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(c)||[],e={browser:d[1]||"",version:d[2]||0};e.browser&&(b[e.browser]=!0,b.version=e.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),a.browser=b}}(jQuery),function(a,b,c){var d={getEvent:function(a){return a||b.event},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1}},e=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,1e3/60)},f=function(b){var c=a(this).data("enscroll"),d=this,e=c.settings,f=function(){var b=a(this).data("enscroll"),c=b.settings;b&&c.showOnHover&&(c.verticalScrolling&&"none"!==a(b.verticalTrackWrapper).css("display")&&a(b.verticalTrackWrapper).stop().fadeTo("fast",0),c.horizontalScrolling&&"none"!==a(b.horizontalTrackWrapper).css("display")&&a(b.horizontalTrackWrapper).stop().fadeTo("fast",0),b._fadeTimer=null)};c&&e.showOnHover&&(c._fadeTimer?clearTimeout(c._fadeTimer):(e.verticalScrolling&&"none"!==a(c.verticalTrackWrapper).css("display")&&a(c.verticalTrackWrapper).stop().fadeTo("fast",1),e.horizontalScrolling&&"none"!==a(c.horizontalTrackWrapper).css("display")&&a(c.horizontalTrackWrapper).stop().fadeTo("fast",1)),b!==!1&&(c._fadeTimer=setTimeout(function(){f.call(d)},1500)))},g=function(b,c){var d=a(b),e=d.data("enscroll"),g=d.scrollTop();e&&e.settings.verticalScrolling&&(d.scrollTop(g+c),e.settings.showOnHover&&f.call(b))},h=function(b,c){var d=a(b),e=d.data("enscroll"),g=d.scrollLeft();e&&e.settings.horizontalScrolling&&(d.scrollLeft(g+c),e.settings.showOnHover&&f.call(b))},i=function(b){if(1===b.which){var d,g,h,i,j,k,l,m,n,o=b.data.pane,p=a(o).data("enscroll"),q=!0,r=function(){q&&(h!==i&&(a(o).scrollTop(h*n/m),i=h),e(r),f.call(o))},s=function(a){return q&&(h=a.clientY-k-j,h=Math.min(0>h?0:h,m)),!1},t=function(){return q=!1,c.body.style.cursor=l,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical"),a(c).off("mouseout.enscroll.vertical"),!1};return d=a(p.verticalTrackWrapper).find(".enscroll-track"),g=d.children().first()[0],h=parseInt(g.style.top,10),n=o.scrollHeight-a(o).innerHeight(),j=b.clientY-a(g).offset().top,m=d.height()-a(g).outerHeight(),k=d.offset().top,a(c.body).on({"mousemove.enscroll.vertical":s,"mouseup.enscroll.vertical":function(a){t.call(g,a)}}),a(c).on("mouseout.enscroll.vertical",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&t.call(g,a)}),d.hasClass("dragging")||(d.addClass("dragging"),l=a(c.body).css("cursor"),this.style.cursor=c.body.style.cursor="ns-resize"),r(),!1}},j=function(b){if(1===b.which){var d,g,h,i,j,k,l,m,n,o=b.data.pane,p=a(o).data("enscroll"),q=!0,r=function(){q&&(h!==i&&(a(o).scrollLeft(h*j/n),i=h),e(r),f.call(o))},s=function(a){return q&&(h=a.clientX-l-k,h=Math.min(0>h?0:h,n),f.call(o)),!1},t=function(){return q=!1,d.removeClass("dragging"),c.body.style.cursor=m,this.style.cursor="",d.removeClass("dragging"),a(c.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal"),a(c).off("mouseout.enscroll.horizontal"),!1};return d=a(p.horizontalTrackWrapper).find(".enscroll-track"),g=d.children().first()[0],h=parseInt(g.style.left,10),j=o.scrollWidth-a(o).innerWidth(),k=b.clientX-a(g).offset().left,n=d.width()-a(g).outerWidth(),l=d.offset().left,a(c.body).on({"mousemove.enscroll.horizontal":s,"mouseup.enscroll.horizontal":function(a){t.call(g,a)}}),a(c).on("mouseout.enscroll.horizontal",function(a){a.target.nodeName&&"HTML"===a.target.nodeName.toUpperCase()&&t.call(g,a)}),d.hasClass("dragging")||(d.addClass("dragging"),m=a("body").css("cursor"),this.style.cursor=c.body.style.cursor="ew-resize"),r(),!1}},k=function(a){var b,c,e,f,i=this.data("enscroll");i&&(a=d.getEvent(a),e=a.detail?-a.detail:window.client&&window.client.engine.opera&&window.client.engine.opera<9.5?-a.wheelDelta:a.wheelDelta,f=i.settings.scrollIncrement,a.wheelDelta&&a.wheelDeltaX&&a.wheelDelta===a.wheelDeltaX||a.axis&&a.HORIZONTAL_AXIS&&a.axis===a.HORIZONTAL_AXIS?(b=this.scrollLeft(),h(this,0>e?f:-f),b!==this.scrollLeft()&&d.preventDefault(a)):(c=this.scrollTop(),g(this,0>e?f:-f),c!==this.scrollTop()&&d.preventDefault(a)))},l=function(){var b,c,d,e=a(this),f=e.data("enscroll");f&&(f.settings.verticalScrolling&&(c=a(f.verticalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollTop()/(this.scrollHeight-e.innerHeight()),d=isNaN(d)?0:d,b.style.top=d*(a(c).height()-a(b).outerHeight())+"px"),f.settings.horizontalScrolling&&(c=a(f.horizontalTrackWrapper).find(".enscroll-track")[0],b=c.firstChild,d=e.scrollLeft()/(this.scrollWidth-e.innerWidth()),d=isNaN(d)?0:d,b.style.left=d*(a(c).width()-a(b).innerWidth())+"px"))},m=function(b){var c,d=a(this),e=d.data("enscroll");if(b.target===this&&e){switch(c=e.settings.scrollIncrement,b.keyCode){case 32:case 34:return g(this,d.height()),!1;case 33:return g(this,-d.height()),!1;case 35:return g(this,this.scrollHeight),!1;case 36:return g(this,-this.scrollHeight),!1;case 37:return h(this,-c),!1;case 38:return g(this,-c),!1;case 39:return h(this,c),!1;case 40:return g(this,c),!1}return!0}},n=function(a){var b,c,d,f,i,j,k,l=this,m=function(a){b=a.touches[0].clientX,c=a.touches[0].clientY,d||(d=c===i&&b===f?void 0:Math.abs(i-c)>Math.abs(f-b)?"y":"x"),a.preventDefault()},n=function(){j&&("y"===d?(g(l,i-c),k=i-c,i=c):"x"===d&&(h(l,f-b),k=f-b,f=b),e(n))},o=function(){var a=0,b=Math.round(Math.abs(1.75*k)),c=10*k*Math.log(2);this.removeEventListener("touchmove",m,!1),this.removeEventListener("touchend",o,!1),j=!1,e(function f(){if(a!==b&&!j){var i=Math.round(c/b*Math.pow(2,-10*a/b+1));isNaN(i)||0===i||(a+=1,"y"===d?g(l,i):h(l,i),e(f))}})};1===a.touches.length&&(f=a.touches[0].clientX,i=a.touches[0].clientY,j=!0,this.addEventListener("touchmove",m,!1),this.addEventListener("touchend",o,!1),e(n))},o={reposition:function(){return this.each(function(){var b,c,d,e,f,g=a(this),h=g.data("enscroll"),i=function(a,b,c){a.style.left=b+"px",a.style.top=c+"px"},j=function(b,c){var d=a(b).css(c),e=/^-?\d+/.exec(d);return e?+e[0]:0};h&&(d=g.position(),f=a.browser.msie&&/^6/.test(a.browser.version),f&&(e=g.offsetParent()[0]),b=h.corner,h.settings.verticalScrolling&&(c=h.verticalTrackWrapper,i(c,d.left+g.outerWidth()-a(c).width()-j(this,"border-right-width")-(f?j(e,"padding-left"):0),d.top+j(this,"border-top-width")+(f?j(e,"border-top-width"):0))),h.settings.horizontalScrolling&&(c=h.horizontalTrackWrapper,i(c,d.left+j(this,"border-left-width")-(f?j(e,"padding-left"):0),d.top+g.outerHeight()-a(c).height()-j(this,"border-bottom-width")+(f?j(e,"border-bottom-width"):0))),b&&i(b,d.left+g.outerWidth()-a(b).outerWidth()-j(this,"border-right-width")-(f?j(e,"padding-left"):0),d.top+g.outerHeight()-a(b).outerHeight()-j(this,"border-bottom-width")+(f?j(e,"border-bottom-width"):0)))})},resize:function(){return this.each(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=a(this),s=r.data("enscroll");r.is(":visible")&&s&&(b=s.settings,b.verticalScrolling&&(e=s.verticalTrackWrapper,c=r.innerHeight(),f=c/this.scrollHeight,g=a(e).find(".enscroll-track")[0],j=a(e).find("."+b.scrollUpButtonClass),k=a(e).find("."+b.scrollDownButtonClass),i=b.horizontalScrolling?c-a(s.horizontalTrackWrapper).find(".enscroll-track").outerHeight():c,i-=a(g).outerHeight()-a(g).height()+j.outerHeight()+k.outerHeight(),n=g.firstChild,p=Math.max(f*i,b.minScrollbarLength),p-=a(n).outerHeight()-a(n).height(),e.style.display="none",g.style.height=i+"px",n.style.height=p+"px",1>f&&(f=r.scrollTop()/(this.scrollHeight-r.height()),n.style.top=f*(i-p)+"px",e.style.display="block")),b.horizontalScrolling&&(e=s.horizontalTrackWrapper,d=r.innerWidth(),f=d/this.scrollWidth,g=a(e).find(".enscroll-track")[0],l=a(e).find("."+b.scrollLeftButtonClass),m=a(e).find("."+b.scrollRightButtonClass),h=b.verticalScrolling?d-a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth():d,h-=a(g).outerWidth()-a(g).width()+l.outerWidth()+m.outerWidth(),n=g.firstChild,o=Math.max(f*h,b.minScrollbarLength),o-=a(n).outerWidth()-a(n).width(),e.style.display="none",g.style.width=h+"px",n.style.width=o+"px",1>f&&(f=r.scrollLeft()/(this.scrollWidth-r.width()),n.style.left=f*(h-o)+"px",e.style.display="block"),s._prybar&&(q=s._prybar,this.removeChild(q),b.verticalScrolling&&(q.style.width=this.scrollWidth+a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth()+"px",this.appendChild(q)))),s.corner&&(s.corner.style.display=s.verticalTrackWrapper&&s.horizontalTrackWrapper&&a(s.verticalTrackWrapper).is(":visible")&&a(s.horizontalTrackWrapper).is(":visible")?"block":"none"))})},startPolling:function(){return this.each(function(){var b,c=a(this).data("enscroll"),d=this,e=a(d),f=-1,g=-1,h=-1,i=-1,j=function(){if(c.settings.pollChanges){var a=d.scrollWidth,k=d.scrollHeight,l=e.width(),m=e.height(),n=e.offset();(c.settings.verticalScrolling&&(m!==g||k!==i)||c.settings.horizontalScrolling&&(l!==f||a!==h))&&(h=a,i=k,o.resize.call(e)),(b.left!==n.left||b.top!==n.top||l!==f||m!==g)&&(b=n,f=l,g=m,o.reposition.call(e)),setTimeout(j,350)}};c&&(c.settings.pollChanges=!0,i=d.scrollHeight,h=d.scrollWidth,b=e.offset(),j())})},stopPolling:function(){return this.each(function(){var b=a(this).data("enscroll");b&&(b.settings.pollChanges=!1)})},destroy:function(){return this.each(function(){var c,d,e=a(this),f=e.data("enscroll");f&&(o.stopPolling.call(e),d=f._mouseScrollHandler,f.settings.verticalScrolling&&(c=f.verticalTrackWrapper,a(c).remove(),c=null),f.settings.horizontalScrolling&&(c=f.horizontalTrackWrapper,a(c).remove(),c=null),f._fadeTimer&&clearTimeout(f._fadeTimer),f.corner&&a(f.corner).remove(),f._prybar&&f._prybar.parentNode&&f._prybar.parentNode===this&&a(f._prybar).remove(),this.setAttribute("style",f._style||""),f._hadTabIndex||e.removeAttr("tabindex"),e.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null),this.removeEventListener?(this.removeEventListener("mousewheel",d,!1),this.removeEventListener("DOMMouseScroll",d,!1),this.removeEventListener("touchstart",n,!1)):this.detachEvent&&this.detachEvent("onmousewheel",d),a(b).off("resize.enscroll.window"))})}};a.fn.enscroll=function(d){if(o[d])return o[d].call(this);var e=a.extend({verticalScrolling:!0,horizontalScrolling:!1,showOnHover:!1,scrollIncrement:20,minScrollbarLength:40,pollChanges:!0,drawCorner:!0,drawScrollButtons:!1,clickTrackToScroll:!0,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,addPaddingToPane:!0,horizontalHandleHTML:'
',verticalHandleHTML:'
'},d);return this.each(function(){if(e.verticalScrolling||e.horizontalScrolling){var d,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=a(this),G=this,H=F.attr("style"),I=!0,J={position:"absolute","z-index":e.zIndex,margin:0,padding:0},K=function(a){k.call(F,a)},L=function(b,c){"string"==typeof c?a(b).html(c):"object"==typeof c&&null!==c&&c.nodeType&&1===c.nodeType&&b.appendChild(c)};if(e.verticalScrolling){p=c.createElement("div"),r=c.createElement("div"),t=c.createElement("a"),a(r).css("position","relative").addClass("enscroll-track").addClass(e.verticalTrackClass).appendTo(p),e.drawScrollButtons&&(u=c.createElement("a"),v=c.createElement("a"),a(u).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(e.scrollUpButtonClass).on("click",function(){return g(G,-e.scrollIncrement),!1}).insertBefore(r),a(v).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){return g(G,e.scrollIncrement),!1}).addClass(e.scrollDownButtonClass).appendTo(p)),e.clickTrackToScroll&&a(r).on("click",function(b){b.target===this&&g(G,b.pageY>a(t).offset().top?F.height():-F.height())}),a(t).css({position:"absolute","z-index":1}).attr("href","").addClass(e.verticalHandleClass).mousedown({pane:this},i).click(function(){return!1}).appendTo(r),L(t,e.verticalHandleHTML),a(p).css(J).insertAfter(this),e.showOnHover&&a(p).css("opacity",0).on("mouseover.enscroll.vertical",function(){f.call(G,!1)}).on("mouseout.enscroll.vertical",function(){f.call(G)}),z=a(r).outerWidth(),e.addPaddingToPane&&F.css({width:F.width()-z+"px","padding-right":parseInt(F.css("padding-right"),10)+z+"px"});try{D=parseInt(F.css("outline-width"),10),0!==D&&!isNaN(D)||"none"!==F.css("outline-style")||F.css("outline","none")}catch(M){F.css("outline","none")}}e.horizontalScrolling&&(d=c.createElement("div"),q=c.createElement("div"),s=c.createElement("a"),a(q).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(e.horizontalTrackClass).appendTo(d),e.drawScrollButtons&&(w=c.createElement("a"),x=c.createElement("a"),a(w).css("display","block").attr("href","").on("click",function(){return h(G,-e.scrollIncrement),!1}).addClass(e.scrollLeftButtonClass).insertBefore(q),a(x).css("display","block").attr("href","").on("click",function(){return h(G,e.scrollIncrement),!1}).addClass(e.scrollRightButtonClass).appendTo(d)),e.clickTrackToScroll&&a(q).on("click",function(b){b.target===this&&h(G,b.pageX>a(s).offset().left?F.width():-F.width())}),a(s).css({position:"absolute","z-index":1}).attr("href","").addClass(e.horizontalHandleClass).click(function(){return!1}).mousedown({pane:this},j).appendTo(q),L(s,e.horizontalHandleHTML),a(d).css(J).insertAfter(this),e.showOnHover&&a(d).css("opacity",0).on("mouseover.enscroll.horizontal",function(){f.call(G,!1)}).on("mouseout.enscroll.horizontal",function(){f.call(G)}),y=a(q).outerHeight(),e.addPaddingToPane&&F.css({height:F.height()-y+"px","padding-bottom":parseInt(F.css("padding-bottom"),10)+y+"px"}),(!a.browser.msie||a.browser.msie&&a.browser.version>7)&&(E=document.createElement("div"),a(E).css({width:"1px",height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this))),e.verticalScrolling&&e.horizontalScrolling&&e.drawCorner&&(A=c.createElement("div"),a(A).addClass(e.cornerClass).css(J).insertAfter(this)),C=F.attr("tabindex"),(!C||C.length<1)&&(F.attr("tabindex",0),I=!1);try{B=F.css("outline"),(!B||B.length<1)&&F.css("outline","none")}catch(M){F.css("outline","none")}F.on({"scroll.enscroll.pane":function(a){l.call(this,a)},"keydown.enscroll.pane":m}).css("overflow","hidden").data("enscroll",{settings:e,horizontalTrackWrapper:d,verticalTrackWrapper:p,corner:A,_prybar:E,_mouseScrollHandler:K,_hadTabIndex:I,_style:H}),a(b).on("resize.enscroll.window",function(){o.reposition.call(F)}),e.showOnHover&&F.on("mouseenter.enscroll.pane",function(){f.call(this)}),this.addEventListener?(this.addEventListener("mousewheel",K,!1),this.addEventListener("DOMMouseScroll",K,!1),this.addEventListener("touchstart",n,!1)):this.attachEvent&&this.attachEvent("onmousewheel",K),e.pollChanges?o.startPolling.call(F):(o.resize.call(F),o.reposition.call(F)),a(r,q).removeClass(e.verticalTrackClass).addClass(e.verticalTrackClass)}})}}(jQuery,window,document);
--------------------------------------------------------------------------------
/releases/enscroll-0.4.0.min.js:
--------------------------------------------------------------------------------
1 | (function(e,f){if(!e.browser){var c={},d=navigator.userAgent.toLowerCase(),b=/(chrome)[ \/]([\w.]+)/.exec(d)||/(webkit)[ \/]([\w.]+)/.exec(d)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(d)||/(msie) ([\w.]+)/.exec(d)||d.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(d)||[],a={browser:b[1]||"",version:b[2]||0};if(a.browser){c[a.browser]=true;c.version=a.version}if(c.chrome){c.webkit=true}else{if(c.webkit){c.safari=true}}e.browser=c}}(jQuery));(function(d,h,o){var e={getEvent:function(p){return p||h.event},preventDefault:function(p){if(p.preventDefault){p.preventDefault()}else{p.returnValue=false}}},k=h.requestAnimationFrame||h.mozRequestAnimationFrame||h.webkitRequestAnimationFrame||h.oRequestAnimationFrame||h.msRequestAnimationFrame||function(p){setTimeout(p,1000/60)},c=function(s){var r=d(this).data("enscroll"),q=this,p=r.settings,t=function(){var v=d(this).data("enscroll"),u=v.settings;if(v&&u.showOnHover){if(u.verticalScrolling&&d(v.verticalTrackWrapper).css("display")!=="none"){d(v.verticalTrackWrapper).stop().fadeTo("fast",0)}if(u.horizontalScrolling&&d(v.horizontalTrackWrapper).css("display")!=="none"){d(v.horizontalTrackWrapper).stop().fadeTo("fast",0)}v._fadeTimer=null}};if(r&&p.showOnHover){if(r._fadeTimer){clearTimeout(r._fadeTimer)}else{if(p.verticalScrolling&&d(r.verticalTrackWrapper).css("display")!=="none"){d(r.verticalTrackWrapper).stop().fadeTo("fast",1)}if(p.horizontalScrolling&&d(r.horizontalTrackWrapper).css("display")!=="none"){d(r.horizontalTrackWrapper).stop().fadeTo("fast",1)}}if(s!==false){r._fadeTimer=setTimeout(function(){t.call(q)},1500)}}},i=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollTop();if(s&&s.settings.verticalScrolling){r.scrollTop(q+p);if(s.settings.showOnHover){c.call(t)}}},l=function(t,p){var r=d(t),s=r.data("enscroll"),q=r.scrollLeft();if(s&&s.settings.horizontalScrolling){r.scrollLeft(q+p);if(s.settings.showOnHover){c.call(t)}}},n=function(s){if(s.which!==1){return}var v=s.data.pane,x=d(v).data("enscroll"),D=true,t,y,p,r,q,w,E,z,A,u=function(){if(D){if(p!==r){d(v).scrollTop(p*A/z);r=p}k(u);c.call(v)}},C=function(F){if(D){p=F.clientY-w-q;p=Math.min(p<0?0:p,z)}return false},B=function(F){D=false;o.body.style.cursor=E;this.style.cursor="";d(t).removeClass("dragging");d(o.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical");return false};t=d(x.verticalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=t.firstChild;p=parseInt(y.style.top,10);A=v.scrollHeight-d(v).innerHeight();q=s.clientY-d(y).offset().top;z=d(t).height()-d(y).outerHeight();w=d(t).offset().top;d(o.body).on({"mousemove.enscroll.vertical":C,"mouseup.enscroll.vertical":function(F){B.call(y,F)}});E=d(o.body).css("cursor");this.style.cursor=o.body.style.cursor="ns-resize";u();return false},a=function(q){if(q.which!==1){return}var u=q.data.pane,w=d(u).data("enscroll"),D=true,s,y,p,r,A,v,x,E,z,t=function(){if(D){if(p!==r){d(u).scrollLeft(p*A/z);r=p}k(t);c.call(u)}},C=function(F){if(D){p=F.clientX-x-v;p=Math.min(p<0?0:p,z);c.call(u)}return false},B=function(F){D=false;d(s).removeClass("dragging");o.body.style.cursor=E;this.style.cursor="";d(s).removeClass("dragging");d(o.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal");return false};s=d(w.horizontalTrackWrapper).find(".enscroll-track").addClass("dragging").get(0);y=s.firstChild;p=parseInt(y.style.left,10);A=u.scrollWidth-d(u).innerWidth();v=q.clientX-d(y).offset().left;z=d(s).width()-d(y).outerWidth();x=d(s).offset().left;d(o.body).on({"mousemove.enscroll.horizontal":C,"mouseup.enscroll.horizontal":function(F){B.call(y,F)}});E=d("body").css("cursor");this.style.cursor=o.body.style.cursor="ew-resize";t();return false},m=function(r){var s=this.data("enscroll"),t,p,u,q;if(s){r=e.getEvent(r);u=r.detail?-r.detail:(window.client&&window.client.engine.opera&&window.client.engine.opera<9.5)?-r.wheelDelta:r.wheelDelta;q=s.settings.scrollIncrement;if(r.wheelDelta&&r.wheelDeltaX&&r.wheelDelta===r.wheelDeltaX||r.axis&&r.HORIZONTAL_AXIS&&r.axis===r.HORIZONTAL_AXIS){t=this.scrollLeft();l(this,u<0?q:-q);if(t!==this.scrollLeft()){e.preventDefault(r)}}else{p=this.scrollTop();i(this,u<0?q:-q);if(p!==this.scrollTop()){e.preventDefault(r)}}}},j=function(q){var u=d(this),t=u.data("enscroll"),s,p,r;if(t){if(t.settings.verticalScrolling){p=d(t.verticalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollTop()/(this.scrollHeight-u.innerHeight());r=isNaN(r)?0:r;s.style.top=(r*(d(p).height()-d(s).outerHeight()))+"px"}if(t.settings.horizontalScrolling){p=d(t.horizontalTrackWrapper).find(".enscroll-track").get(0);s=p.firstChild;r=u.scrollLeft()/(this.scrollWidth-u.innerWidth());r=isNaN(r)?0:r;s.style.left=(r*(d(p).width()-d(s).innerWidth()))+"px"}}},f=function(r){var t=d(this),q=this,s=t.data("enscroll"),p;if(r.target===this&&s){p=s.settings.scrollIncrement;switch(r.keyCode){case 32:case 34:i(this,t.height());return false;case 33:i(this,-t.height());return false;case 35:i(this,this.scrollHeight);return false;case 36:i(this,-this.scrollHeight);return false;case 37:l(this,-p);return false;case 38:i(this,-p);return false;case 39:l(this,p);return false;case 40:i(this,p);return false}return true}},b=function(q){var z,w,v,y,t,p,A,s=this,u=function(B){z=B.touches[0].clientX;w=B.touches[0].clientY;if(!v){if(w===t&&z===y){v=undefined}else{if(Math.abs(t-w)>Math.abs(y-z)){v="y"}else{v="x"}}}B.preventDefault()},r=function(){if(!p){return}if(v==="y"){i(s,t-w);A=t-w;t=w}else{if(v==="x"){l(s,y-z);A=y-z;y=z}}k(r)},x=function(){var B=0,E=Math.round(Math.abs(A*1.75)),D=10*A*Math.log(2);this.removeEventListener("touchmove",u,false);this.removeEventListener("touchend",x,false);p=false;k(function C(){if(B===E||p){return}var F=Math.round(D/E*Math.pow(2,-10*B/E+1));if(!isNaN(F)&&F!==0){B+=1;if(v==="y"){i(s,F)}else{l(s,F)}k(C)}})};if(q.touches.length===1){y=q.touches[0].clientX;t=q.touches[0].clientY;p=true;this.addEventListener("touchmove",u,false);this.addEventListener("touchend",x,false);k(r)}},g={reposition:function(){return this.each(function(){var u=d(this),t=u.data("enscroll"),r=function(A,z,B){A.style.left=z+"px";A.style.top=B+"px"},x=function(z,B){var y=d(z).css(B),A=/^-?\d+/.exec(y);return A?+A[0]:0},w,p,s,q,v;if(t){s=u.position();v=d.browser.msie&&/^6/.test(d.browser.version);if(v){q=u.offsetParent().get(0)}w=t.corner;if(t.settings.verticalScrolling){p=t.verticalTrackWrapper;r(p,s.left+u.outerWidth()-d(p).width()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+x(this,"border-top-width")+(v?x(q,"border-top-width"):0))}if(t.settings.horizontalScrolling){p=t.horizontalTrackWrapper;r(p,s.left+x(this,"border-left-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(p).height()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}if(w){r(w,s.left+u.outerWidth()-d(w).outerWidth()-x(this,"border-right-width")-(v?x(q,"padding-left"):0),s.top+u.outerHeight()-d(w).outerHeight()-x(this,"border-bottom-width")+(v?x(q,"border-bottom-width"):0))}}})},resize:function(){return this.each(function(){var s=d(this),G=s.data("enscroll"),C,w,F,A,q,z,v,p,B,t,x,r,D,u,y,E;if(s.is(":visible")&&G){C=G.settings;if(C.verticalScrolling){A=G.verticalTrackWrapper;w=s.innerHeight();q=w/this.scrollHeight;z=d(A).find(".enscroll-track").get(0);B=d(A).find("."+C.scrollUpButtonClass);t=d(A).find("."+C.scrollDownButtonClass);p=C.horizontalScrolling?w-d(G.horizontalTrackWrapper).find(".enscroll-track").outerHeight():w;p-=d(z).outerHeight()-d(z).height()+B.outerHeight()+t.outerHeight();D=z.firstChild;y=Math.max(q*p,C.minScrollbarLength);y-=d(D).outerHeight()-d(D).height();A.style.display="none";z.style.height=p+"px";D.style.height=y+"px";if(q<1){q=s.scrollTop()/(this.scrollHeight-s.height());D.style.top=(q*(p-y))+"px";A.style.display="block"}}if(C.horizontalScrolling){A=G.horizontalTrackWrapper;F=s.innerWidth();q=F/this.scrollWidth;z=d(A).find(".enscroll-track").get(0);x=d(A).find("."+C.scrollLeftButtonClass);r=d(A).find("."+C.scrollRightButtonClass);v=C.verticalScrolling?F-d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth():F;v-=d(z).outerWidth()-d(z).width()+x.outerWidth()+r.outerWidth();D=z.firstChild;u=Math.max(q*v,C.minScrollbarLength);u-=d(D).outerWidth()-d(D).width();A.style.display="none";z.style.width=v+"px";D.style.width=u+"px";if(q<1){q=s.scrollLeft()/(this.scrollWidth-s.width());D.style.left=(q*(v-u))+"px";A.style.display="block"}if(G._prybar){E=G._prybar;this.removeChild(E);if(C.verticalScrolling){E.style.width=(this.scrollWidth+d(G.verticalTrackWrapper).find(".enscroll-track").outerWidth())+"px";this.appendChild(E)}}}if(G.corner){G.corner.style.display=G.verticalTrackWrapper&&G.horizontalTrackWrapper&&d(G.verticalTrackWrapper).is(":visible")&&d(G.horizontalTrackWrapper).is(":visible")?"block":"none"}}})},startPolling:function(){return this.each(function(){var t=d(this).data("enscroll"),s=this,q=d(s),w=-1,r=-1,x=-1,p=-1,v,u=function(){if(t.settings.pollChanges){var y=s.scrollWidth,z=s.scrollHeight,A=q.width(),C=q.height(),B=q.offset();if(t.settings.verticalScrolling&&(C!==r||z!==p)||t.settings.horizontalScrolling&&(A!==w||y!==x)){x=y;p=z;g.resize.call(q)}if(v.left!==B.left||v.top!==B.top||A!==w||C!==r){v=B;w=A;r=C;g.reposition.call(q)}setTimeout(u,350)}};if(t){t.settings.pollChanges=true;p=s.scrollHeight;x=s.scrollWidth;v=q.offset();u()}})},stopPolling:function(){return this.each(function(){var p=d(this).data("enscroll");if(p){p.settings.pollChanges=false}})},destroy:function(){return this.each(function(){var r=d(this),q=r.data("enscroll"),p,s;if(q){g.stopPolling.call(r);s=q._mouseScrollHandler;if(q.settings.verticalScrolling){p=q.verticalTrackWrapper;d(p).remove();p=null}if(q.settings.horizontalScrolling){p=q.horizontalTrackWrapper;d(p).remove();p=null}if(q._fadeTimer){clearTimeout(q._fadeTimer)}if(q.corner){d(q.corner).remove()}if(q._prybar&&q._prybar.parentNode&&q._prybar.parentNode===this){d(q._prybar).remove()}this.setAttribute("style",q._style||"");if(!q._hadTabIndex){r.removeAttr("tabindex")}r.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll",null);if(this.removeEventListener){this.removeEventListener("mousewheel",s,false);this.removeEventListener("DOMMouseScroll",s,false);this.removeEventListener("touchstart",b,false)}else{if(this.detachEvent){this.detachEvent("onmousewheel",s)}}d(h).off("resize.enscroll.window")}})}};d.fn.enscroll=function(q){if(g[q]){return g[q].call(this)}var p=d.extend({verticalScrolling:true,horizontalScrolling:false,showOnHover:false,scrollIncrement:20,minScrollbarLength:40,pollChanges:true,drawCorner:true,drawScrollButtons:false,clickTrackToScroll:true,verticalTrackClass:"vertical-track",horizontalTrackClass:"horizontal-track",horizontalHandleClass:"horizontal-handle",verticalHandleClass:"vertical-handle",scrollUpButtonClass:"scroll-up-btn",scrollDownButtonClass:"scroll-down-btn",scrollLeftButtonClass:"scroll-left-btn",scrollRightButtonClass:"scroll-right-btn",cornerClass:"scrollbar-corner",zIndex:1,horizontalHandleHTML:'
',verticalHandleHTML:'
'},q);return this.each(function(){if(!p.verticalScrolling&&!p.horizontalScrolling){return}var B=d(this),I=this,U=B.innerWidth(),E=B.innerHeight(),u=B.offset(),J=B.attr("style"),s=true,x=I.scrollWidth,H=I.scrollHeight,M,K,G,R,O,A,L,z,F,S,t,D,C,y,T,Q,P,r={position:"absolute","z-index":p.zIndex,margin:0,padding:0},w=function(V){m.call(B,V)},v=function(W,V){if(typeof V==="string"){d(W).html(V)}else{if(typeof V==="object"&&V!==null&&V.nodeType&&V.nodeType===1){W.appendChild(V)}}};if(p.verticalScrolling){K=o.createElement("div");R=o.createElement("div");A=o.createElement("a");d(R).css("position","relative").addClass("enscroll-track").addClass(p.verticalTrackClass).appendTo(K);if(p.drawScrollButtons){L=o.createElement("a");z=o.createElement("a");d(L).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").addClass(p.scrollUpButtonClass).on("click",function(){i(I,-p.scrollIncrement);return false}).insertBefore(R);d(z).css({display:"block","text-decoration":"none"}).attr("href","").html(" ").on("click",function(){i(I,p.scrollIncrement);return false}).addClass(p.scrollDownButtonClass).appendTo(K)}if(p.clickTrackToScroll){d(R).on("click",function(V){if(V.target===this){i(I,V.pageY>d(A).offset().top?B.height():-B.height())}})}d(A).css({position:"absolute","z-index":1}).attr("href","").addClass(p.verticalHandleClass).mousedown({pane:this},n).click(function(){return false}).appendTo(R);v(A,p.verticalHandleHTML);d(K).css(r).insertAfter(this);if(p.showOnHover){d(K).css("opacity",0).on("mouseover.enscroll.vertical",function(){c.call(I,false)}).on("mouseout.enscroll.vertical",function(){c.call(I)})}D=d(R).outerWidth();B.css({width:(B.width()-D)+"px","padding-right":(parseInt(B.css("padding-right"),10)+D)+"px"});try{Q=parseInt(B.css("outline-width"),10);if((Q===0||isNaN(Q))&&B.css("outline-style")==="none"){B.css("outline","none")}}catch(N){B.css("outline","none")}}if(p.horizontalScrolling){M=o.createElement("div");G=o.createElement("div");O=o.createElement("a");d(G).css({position:"relative","z-index":1}).addClass("enscroll-track").addClass(p.horizontalTrackClass).appendTo(M);if(p.drawScrollButtons){F=o.createElement("a");S=o.createElement("a");d(F).css("display","block").attr("href","").on("click",function(){l(I,-p.scrollIncrement);return false}).addClass(p.scrollLeftButtonClass).insertBefore(G);d(S).css("display","block").attr("href","").on("click",function(){l(I,p.scrollIncrement);return false}).addClass(p.scrollRightButtonClass).appendTo(M)}if(p.clickTrackToScroll){d(G).on("click",function(V){if(V.target===this){l(I,V.pageX>d(O).offset().left?B.width():-B.width())}})}d(O).css({position:"absolute","z-index":1}).attr("href","").addClass(p.horizontalHandleClass).click(function(){return false}).mousedown({pane:this},a).appendTo(G);v(O,p.horizontalHandleHTML);d(M).css(r).insertAfter(this);if(p.showOnHover){d(M).css("opacity",0).on("mouseover.enscroll.horizontal",function(){c.call(I,false)}).on("mouseout.enscroll.horizontal",function(){c.call(I)})}t=d(G).outerHeight();B.css({height:(B.height()-t)+"px","padding-bottom":(parseInt(B.css("padding-bottom"),10)+t)+"px"});if(!d.browser.msie||d.browser.msie&&d.browser.version>7){P=document.createElement("div");d(P).css({width:"1px",height:"1px",visibility:"hidden",padding:0,margin:"-1px"}).appendTo(this)}}if(p.verticalScrolling&&p.horizontalScrolling&&p.drawCorner){C=o.createElement("div");d(C).addClass(p.cornerClass).css(r).insertAfter(this)}T=B.attr("tabindex");if(!T||T.length<1){B.attr("tabindex",0);s=false}try{y=B.css("outline");if(!y||y.length<1){B.css("outline","none")}}catch(N){B.css("outline","none")}B.on({"scroll.enscroll.pane":function(V){j.call(this,V)},"keydown.enscroll.pane":f}).css("overflow","hidden").data("enscroll",{settings:p,horizontalTrackWrapper:M,verticalTrackWrapper:K,corner:C,_prybar:P,_mouseScrollHandler:w,_hadTabIndex:s,_style:J});d(h).on("resize.enscroll.window",function(V){g.reposition.call(B)});if(p.showOnHover){B.on("mouseenter.enscroll.pane",function(){c.call(this)})}if(this.addEventListener){this.addEventListener("mousewheel",w,false);this.addEventListener("DOMMouseScroll",w,false);this.addEventListener("touchstart",b,false)}else{if(this.attachEvent){this.attachEvent("onmousewheel",w)}}if(p.pollChanges){g.startPolling.call(B)}else{g.resize.call(B);g.reposition.call(B)}d(R,G).removeClass(p.verticalTrackClass).addClass(p.verticalTrackClass)})}}(jQuery,window,document));
--------------------------------------------------------------------------------