Skip to content

Commit 97943a9

Browse files
committed
Fix Issue #44: Add support for touch swiping
1 parent 85976d4 commit 97943a9

File tree

11 files changed

+73
-16
lines changed

11 files changed

+73
-16
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ There are also some optional features available:
2929
* [Support Adding Tabs Dynamically After Page Load](#ft1)
3030
* [Force Scroll to Tab Edge](#ft2)
3131
* [Force Refresh of Tab Container](#refreshOn)
32+
* [Enable Horizontal Swiping for Touch Screens](#allowScrollbar)
3233

3334

3435

@@ -257,6 +258,34 @@ function forceARefresh() {
257258

258259
```
259260

261+
#### <a id="allowScrollbar"></a>Enable Horizontal Swiping for Touch Screens
262+
263+
To enable horizontal swiping for touch screens, you need to enable horizontal scrolling&mdash;and therefore the horizontal scrollbar&mdash;for the tabs. For WebKit-based browsers, the scrollbar can then be hidden via CSS, but for browsers that don't support `::-webkit-scrollbar` (see [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar) for details), the scrollbar will be visible (which is what this directive was originally built to prevent).
264+
265+
So if you only need to support WebKit-based browsers, here's how to enable swiping:
266+
267+
Add CSS class `scrtabs-allow-scrollbar` to the directive element or any ancestor of the directive element. As long as the tabs fixed container (`.scrtabs-tabs-fixed-container`) is a descendent of that class, it will work.
268+
269+
For example:
270+
```html
271+
<!-- Replace ul.nav-tabs with scrolling-tabs element directive -->
272+
<scrolling-tabs tabs="{{main.uc1Tabs}}"
273+
class="scrtabs-allow-scrollbar"
274+
tab-click="main.handleClickOnTab($event, $index, tab);">
275+
</scrolling-tabs>
276+
277+
278+
<!-- wrap nav-tabs ul in a div with scrolling-tabs-wrapper directive on it -->
279+
<div scrolling-tabs-wrapper class="scrtabs-allow-scrollbar">
280+
<!-- Standard Bootstrap ul.nav-tabs -->
281+
<ul class="nav nav-tabs" role="tablist">
282+
<li ng-class="{ 'active': tab.active, 'disabled': tab.disabled }" ng-repeat="tab in main.uc2Tabs">
283+
<a ng-href="{{'#' + tab.paneId}}" role="tab" data-toggle="tab">{{tab.title}}</a>
284+
</li>
285+
</ul>
286+
</div>
287+
```
288+
260289

261290
License
262291
-------

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-scrolling-tabs",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"main": [
55
"./dist/scrolling-tabs.js",
66
"./dist/scrolling-tabs.css"

dist/scrolling-tabs.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* angular-bootstrap-scrolling-tabs
3-
* @version v1.0.0
3+
* @version v1.1.0
44
* @link https://github.com/mikejacobson/angular-bootstrap-scrolling-tabs
55
* @author Mike Jacobson <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -23,6 +23,11 @@
2323
overflow: hidden;
2424
width: 100%; }
2525

26+
.scrtabs-allow-scrollbar .scrtabs-tabs-fixed-container {
27+
overflow-x: auto; }
28+
.scrtabs-allow-scrollbar .scrtabs-tabs-fixed-container::-webkit-scrollbar {
29+
display: none; }
30+
2631
.scrtabs-tabs-movable-container {
2732
position: relative; }
2833

dist/scrolling-tabs.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
22
* angular-bootstrap-scrolling-tabs
3-
* @version v1.0.0
3+
* @version v1.1.0
44
* @link https://github.com/mikejacobson/angular-bootstrap-scrolling-tabs
55
* @author Mike Jacobson <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
77
*/
8-
98
;(function ($, window) {
109
'use strict';
1110

dist/scrolling-tabs.min.css

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)