diff options
author | Justin Nuß <nuss.justin@gmail.com> | 2014-07-26 11:23:58 +0200 |
---|---|---|
committer | Justin Nuß <nuss.justin@gmail.com> | 2014-07-26 11:23:58 +0200 |
commit | 91480f3791f266369c343c539f8eeec245fa969a (patch) | |
tree | a03ad6062fe4b546367cdb6f9921399458d97441 /public/ng/js/lib/tabs.js | |
parent | 835e85b5ce9921ffd4d50b90b706e02685167331 (diff) | |
parent | 35c75f06a0a4f321021984830d760e67ca0ef8e5 (diff) | |
download | gitea-91480f3791f266369c343c539f8eeec245fa969a.tar.gz gitea-91480f3791f266369c343c539f8eeec245fa969a.zip |
Merge branch 'dev' of https://github.com/gogits/Gogs into issue/281
Conflicts:
modules/base/tool.go
Diffstat (limited to 'public/ng/js/lib/tabs.js')
-rw-r--r-- | public/ng/js/lib/tabs.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/public/ng/js/lib/tabs.js b/public/ng/js/lib/tabs.js new file mode 100644 index 0000000000..9821672050 --- /dev/null +++ b/public/ng/js/lib/tabs.js @@ -0,0 +1,39 @@ +/** + * Created by fuxiaohei on 14-6-26. + */ + +function Tabs(selector) { + + function hide($nav) { + console.log("hide", $nav); + $nav.removeClass("js-tab-nav-show"); + $($nav.data("tab-target")).removeClass("js-tab-show").hide(); + } + + function show($nav) { + console.log("show", $nav); + $nav.addClass("js-tab-nav-show"); + $($nav.data("tab-target")).addClass("js-tab-show").show(); + } + + var $e = $(selector); + if ($e.length) { + // pre-assign init index + var $current = $e.find('.js-tab-nav-show'); + if ($current.length) { + $($current.data("tab-target")).addClass("js-tab-show"); + } + // bind nav click + $e.on("click", ".js-tab-nav", function () { + var $this = $(this); + // is showing, not change. + if ($this.hasClass("js-tab-nav-show")) { + return; + } + $current = $e.find(".js-tab-nav-show").eq(0); + hide($current); + show($this); + }); + console.log("init tabs @", selector) + } +}
\ No newline at end of file |