Compare commits

...

5 Commits
0.4.5 ... 0.4.6

Author SHA1 Message Date
Hyunje Alex Jun
23722670c2 Release 0.4.6.
1. Following options are added.
 - suppressScrollX, suppressScrollY, scrollXMarginOffset and
   scrollYMarginOffset
2013-12-06 11:28:41 +09:00
Hyunje Alex Jun
e390a89f57 Add an example for the scroll suppression feature.
The 'suppressScrollX' and 'suppressScrollY' features were added and
this patch add the example for the features.
2013-12-06 11:25:48 +09:00
Hyunje Alex Jun
6595d602b1 Merge pull request #77 from adrianonantua/master
Added 4 new setting options (suppressScrollX, suppressScrollY, scrollXMarginOffset and scrollYMarginOffset)
2013-12-05 18:25:25 -08:00
Adrian Carneiro
05fadaa786 README.md formatting 2013-11-06 15:28:39 -05:00
Adrian Carneiro
fa806adb55 Added 4 new setting options (suppressScrollX, suppressScrollY, scrollXMarginOffset and scrollYMarginOffset)
Added 4 new setting options (suppressScrollX, suppressScrollY,
scrollXMarginOffset and scrollYMarginOffset)
2013-11-06 15:20:30 -05:00
10 changed files with 79 additions and 16 deletions

View File

@@ -74,6 +74,22 @@ When set to true, and only one (vertical or horizontal) scrollbar is visible the
When set to true, the scroll works with arrow keys on the keyboard. The element is scrolled only when the mouse cursor hovers the element.
**Default: true**
### suppressScrollX
When set to true, the scroll bar in X axis will not be available, regardless of the content width.
**Default: false**
### suppressScrollY
When set to true, the scroll bar in Y axis will not be available, regardless of the content height.
**Default: false**
### scrollXMarginOffset
The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels.
**Default: 0**
### scrollYMarginOffset
The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels.
**Default: 0**
How to Use
----------

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>perfect-scrollbar example</title>
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../src/jquery.mousewheel.js"></script>
<script src="../src/perfect-scrollbar.js"></script>
<style>
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
.spacer { text-align:center }
h2 { text-align: center; }
</style>
<script>
jQuery(document).ready(function ($) {
"use strict";
$('#Default').perfectScrollbar();
$('#SuppressScrollX').perfectScrollbar({suppressScrollX: true});
$('#SuppressScrollY').perfectScrollbar({suppressScrollY: true});
});
</script>
</head>
<body>
<h2>Default</h2>
<div id="Default" class="contentHolder">
<div class="content">
</div>
</div>
<h2>suppressScrollX: true</h2>
<div id="SuppressScrollX" class="contentHolder">
<div class="content">
</div>
</div>
<h2>suppressScrollY: true</h2>
<div id="SuppressScrollY" class="contentHolder">
<div class="content">
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/*! perfect-scrollbar - v0.4.5
/*! perfect-scrollbar - v0.4.6
* http://noraesae.github.com/perfect-scrollbar/
* Copyright (c) 2013 HyeonJe Jun; Licensed MIT */

4
min/perfect-scrollbar-0.4.6.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "perfect-scrollbar",
"version": "0.4.5",
"version": "0.4.6",
"engines": {
"node": ">= 0.8.0"
},

View File

@@ -2,7 +2,7 @@
"name": "perfect-scrollbar",
"title": "perfect-scrollbar",
"description": "Tiny but perfect jquery scrollbar plugin.",
"version": "0.4.5",
"version": "0.4.6",
"author": {
"name": "HyeonJe Jun",
"email": "noraesae@yuiazu.net",

View File

@@ -18,7 +18,11 @@
wheelPropagation: false,
minScrollbarLength: null,
useBothWheelAxes: false,
useKeyboard: true
useKeyboard: true,
suppressScrollX: false,
suppressScrollY: false,
scrollXMarginOffset: 0,
scrollYMarginOffset: 0
};
$.fn.perfectScrollbar = function (suppliedSettings, option) {
@@ -99,8 +103,8 @@
};
var updateScrollbarCss = function () {
$scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: containerWidth});
$scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: containerHeight});
$scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: containerWidth, display: settings.suppressScrollX ? "none": "inherit"});
$scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: containerHeight, display: settings.suppressScrollY ? "none": "inherit"});
$scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth});
$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight});
};
@@ -111,7 +115,7 @@
contentWidth = $this.prop('scrollWidth');
contentHeight = $this.prop('scrollHeight');
if (containerWidth < contentWidth) {
if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) {
scrollbarXActive = true;
scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(containerWidth * containerWidth / contentWidth, 10));
scrollbarXLeft = parseInt($this.scrollLeft() * (containerWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10);
@@ -123,7 +127,7 @@
$this.scrollLeft(0);
}
if (containerHeight < contentHeight) {
if (!settings.suppressScrollY && containerHeight + settings.scrollYMarginOffset < contentHeight) {
scrollbarYActive = true;
scrollbarYHeight = getSettingsAdjustedThumbSize(parseInt(containerHeight * containerHeight / contentHeight, 10));
scrollbarYTop = parseInt($this.scrollTop() * (containerHeight - scrollbarYHeight) / (contentHeight - containerHeight), 10);