BootstrapAdmin/Bootstrap.Admin/Scripts/Content.js

26 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-11-02 12:12:53 +08:00
$(function () {
if ($.browser.versions.ios) $('#content').css({ 'overflow': 'auto', '-webkit-overflow-scrolling': 'touch' });
function setActive(ele) {
ele.addClass('active');
ele.parents("ul").first().find('p').addClass('active');
var breadcrumb = ele.text();
if (breadcrumb === "") $breadNav.hide();
else $breadNav.text(breadcrumb);
2016-11-02 12:12:53 +08:00
}
$('#navbar').attr('data-toggle', "dropdown").addClass('dropdown-toggle');
var $subMenu = $('#submenu');
var $breadNav = $('#breadNav');
$subMenu.on('click', 'a', function (event) {
var $this = $(this);
var act = $this.attr("data-act");
2016-11-06 12:28:53 +08:00
if (act === "True") return true;
event.preventDefault();
$subMenu.find('p, a').removeClass('active');
setActive($this);
$('iframe').attr('src', $this.attr('href'));
});
$subMenu.find('a').each(function (index, ele) {
var $this = $(this);
if ($this.attr('href') == window.location.pathname) setActive($this);
});
});