如何在jquery中实现fa-bar

时间:2019-02-24 10:12:20

标签: jquery html font-awesome

我有一个jquery,我正在尝试对其进行编辑,因此,在单击fa fa-bar之后,我的导航栏项目就会出现,但经过多次尝试后,我无法在此处进行操作是我的jquery

(function() {

  var $menu = $('.navigation nav'),
    optionsList = '<option value="" selected>Go to..</option>';

  $menu.find('li').each(function() {
      var $this = $(this),
        $anchor = $this.children('a'),
        depth = $this.parents('ul').length - 1,
        indent = '';

      if (depth) {
        while (depth > 0) {
          indent += ' - ';
          depth--;
        }

      }
      $(".nav li").parent().addClass("bold");

      optionsList += '<option value="' + $anchor.attr('href') + '">' + indent + ' ' + $anchor.text() + '</option>';
    }).end()
    .after('<select class="selectmenu">' + optionsList + '</select>');

  $('select.selectmenu').on('change', function() {
    window.location = $(this).val();
  });

})();

在此jquery中,我的导航栏显示为选中的div,但在响应式网站上似乎有点呆滞,我希望它位于fa fa-bar中,而不是被选中div。请相应地指导我

0 个答案:

没有答案