Sha256: 88bf049f5665ebc4db7ba83eb43ba4f83263c080e8bd78117af8a891b2376ee4
Contents?: true
Size: 919 Bytes
Versions: 1
Compression:
Stored size: 919 Bytes
Contents
// tab indicator $('.tab-nav').each(function() { $(this).append('<div class="tab-nav-indicator"></div>'); tabSwitch($('.nav > li.active', $(this)), null); }); // tab switch $(document).on('show.bs.tab', '.tab-nav a[data-toggle="tab"]', function(e) { tabSwitch($(e.target), $(e.relatedTarget)); }); function tabSwitch(newTab, oldTab) { var $nav = newTab.closest('.tab-nav'), $navIndicator = $('.tab-nav-indicator', $nav), navOffset = $nav.offset().left, navWidth = $nav.width(), newTabOffset = newTab.offset().left, newTabWidth = newTab.outerWidth(); if (oldTab != null && oldTab.offset().left > newTabOffset) { $navIndicator.addClass('reverse'); setTimeout(function() { $navIndicator.removeClass('reverse'); }, 450); }; $navIndicator.css({ left: (newTabOffset - navOffset), right: navOffset + navWidth - newTabOffset - newTabWidth }); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
material-sass-0.0.2 | app/assets/javascripts/material/tab.js |