PageSourceSearch

https://www.gradjevinarstvo.rs/js/jquery.smartmenus.bootstrap.js

js gradjevinarstvo.rs collected 2026-10-02 12:56:51 UTC 2,794 bytes, 85 lines download raw bytes

1/*!
2 * SmartMenus jQuery Plugin Bootstrap Addon - v0.1.0 - March 27, 2014
3 * http://www.smartmenus.org/
4 *
5 * Copyright 2014 Vasil Dinkov, Vadikom Web Ltd.
6 * http://vadikom.com
7 *
8 * Licensed MIT
9 */
10
11(function ($) {
12
13  // init ondomready
14  $(function () {
15
16    // init all menus
17    $('ul.navbar-nav').each(function () {
18      var $this = $(this);
19      $this.addClass('sm').smartmenus({
20
21        // these are some good default options that should work for all
22        // you can, of course, tweak these as you like
23        subMenusSubOffsetX: 2,
24        subMenusSubOffsetY: -6,
25        subIndicatorsPos: 'append',
26        subIndicatorsText: '...',
27        collapsibleShowFunction: null,
28        collapsibleHideFunction: null,
29        rightToLeftSubMenus: $this.hasClass('navbar-right'),
30        bottomToTopSubMenus: $this.closest('.navbar').hasClass('navbar-fixed-bottom'),
31        overlapControlsInIE: true,
32        showOnClick: true
33
34
35      })
36      // set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true)
37					.find('a.current').parent().addClass('active');
38    })
39			.bind({
40			  // set/unset proper Bootstrap classes for some menu elements
41			  'show.smapi': function (e, menu) {
42			    var $menu = $(menu),
43						$scrollArrows = $menu.dataSM('scroll-arrows'),
44						obj = $(this).data('smartmenus');
45			    if ($scrollArrows) {
46			      // they inherit border-color from body, so we can use its background-color too
47			      $scrollArrows.css('background-color', $(document.body).css('background-color'));
48			    }
49			    $menu.parent().addClass('open' + (obj.isCollapsible() ? ' collapsible' : ''));
50			  },
51			  'hide.smapi': function (e, menu) {
52			    $(menu).parent().removeClass('open collapsible');
53
54
55			  },
56			  // click the parent item to toggle the sub menus (and reset deeper levels and other branches on click)
57			  'click.smapi': function (e, item) {
58			    var obj = $(this).data('smartmenus');
59			    if (obj.isCollapsible()) {
60			      var $item = $(item),
61				                	$sub = $item.parent().dataSM('sub');
62			      if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) {
63			        obj.itemActivate($item);
64			        obj.menuHide($sub);
65			        return false;
66			      }
67			    }
68//			    $('#submenu2level').css('max-height', '28px');
69
70			  },
71			  'beforeshow.smapi': function (e, menu) {
72			    $('#submenu2level').css('overflow', 'hidden');
73			    $('#submenu2level').css('max-height', '1000px');
74			  }
75
76			});
77
78  });
79
80  // fix collapsible menu detection for Bootstrap 3
81  $.SmartMenus.prototype.isCollapsible = function () {
82    return this.$firstLink.parent().css('float') != 'left';
83  };
84
85})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.