如何将相同的JQuery应用于两个导航并为每个导航添加不同的类

时间:2016-02-26 03:25:07

标签: javascript jquery html css

我已将Vertical Fixed Navigation中的Codyhouse实施到我的网站中,一切正常。问题在于我在页面顶部有固定的主导航(即总共两个导航,一个在顶部,一个在垂直)。

我想使两个导航行为相同,即根据滚动位置平滑滚动和切换类,每个导航使用特定的addClass。 我尝试以这种方式从两个导航中选择链​​接元素:

var navigationItems = $('#cd-vertical-nav a', '#main-nav a')

但它不起作用。事实上,在下面的代码片段中,JQuery也不起作用。 Dunno为什么:)但在我的网站中,垂直导航工作正常。

我仍然是一名Noob编码器,也是StackOverflow的新手。我真的很感激任何帮助!

jQuery(document).ready(function($) {
  var contentSections = $('.cd-section'),
    navigationItems = $('#cd-vertical-nav a');

  updateNavigation();
  $(window).on('scroll', function() {
    updateNavigation();
  });

  //smooth scroll to the section
  navigationItems.on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });
  //smooth scroll to second section
  $('.arrow-down').on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });

  //open-close navigation on touch devices
  $('.touch .cd-nav-trigger').on('click', function() {
    $('.touch #cd-vertical-nav').toggleClass('open');

  });
  //close navigation on touch devices when selectin an elemnt from the list
  $('.touch #cd-vertical-nav a').on('click', function() {
    $('.touch #cd-vertical-nav').removeClass('open');
  });

  function updateNavigation() {
    contentSections.each(function() {
      $this = $(this);
      var activeSection = $('#cd-vertical-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
      if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
        navigationItems.eq(activeSection).addClass('is-selected');
      } else {
        navigationItems.eq(activeSection).removeClass('is-selected');
      }
    });
  }

  function smoothScroll(target) {
    $('body,html').animate({
        'scrollTop': target.offset().top - 120
      },
      1500, 'easeOutExpo'
    );
  }
});
.main-header-container {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 9999;
}
header {
  background: DarkGray;
}
a {
  text-decoration: none;
  color: white;
}
li {
  list-style-type: none;
}
.menu {
  line-height: 1.5;
  margin: auto;
}
.menu,
.menu__list {
  padding: 0;
}
.menu__list {
  position: relative;
  display: -webkit-flex;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0;
  list-style: none;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.menu__item {
  display: block;
  margin: 1em 0;
}
.menu__link {
  color: white;
  text-transform: uppercase;
  letter-spacing: 2.3px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 600;
  display: block;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  position: relative;
  margin: 0 1em;
  padding: 0.75em 0;
  text-align: center;
  -webkit-transition: color 0.3s;
  transition: color 0.3s;
}
.menu__link:hover,
.menu__link:focus {
  outline: none;
  color: yellow;
}
.menu__item--current .menu__link {
  color: yellow;
}
.menu__link::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 3px;
  width: 100%;
  height: 2px;
  background: yellow;
  -webkit-transform: scale3d(0, 1, 1);
  transform: scale3d(0, 1, 1);
  -webkit-transition: -webkit-transform 0.1s;
  transition: -webkit-transform 0.1s;
  transition: transform 0.1s;
  transition: transform 0.1s, -webkit-transform 0.1s;
}
.menu__item--current .menu__link::before {
  -webkit-transform: scale3d(1, 1, 1);
  transform: scale3d(1, 1, 1);
  -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
/****Vertical Nav Styles****/

#cd-vertical-nav {
  position: fixed;
  right: 40px;
  top: 50%;
  bottom: auto;
  z-index: 9999;
  -webkit-transform: translate3d(0, -50%, 0);
  transform: translate3d(0, -50%, 0);
}
#cd-vertical-nav li {
  text-align: right;
}
#cd-vertical-nav a {
  display: inline-block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
#cd-vertical-nav a:after {
  content: "";
  display: table;
  clear: both;
}
#cd-vertical-nav a span {
  float: right;
  display: inline-block;
  -webkit-transform: scale(0.6);
  -ms-transform: scale(0.6);
  transform: scale(0.6);
}
#cd-vertical-nav a:hover span {
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav a:hover .cd-label {
  opacity: 1;
}
#cd-vertical-nav a.is-selected .cd-dot {
  background-color: white;
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav .cd-dot {
  position: relative;
  top: 8px;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background-color: white;
  -webkit-transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.3s;
  transition: transform 0.5s, background-color 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.3s;
  -webkit-transform-origin: 50% 50%;
  -ms-transform-origin: 50% 50%;
  transform-origin: 50% 50%;
}
#cd-vertical-nav .cd-label {
  position: relative;
  margin-right: 10px;
  padding: .4em .5em;
  color: white;
  font-size: 14px;
  font-size: 0.875rem;
  letter-spacing: 1.3px;
  font-weight: 400;
  -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: transform 0.3s, opacity 0.3s;
  transition: transform 0.3s, opacity 0.3s, -webkit-transform 0.3s;
  opacity: 0;
  -webkit-transform-origin: 100% 50%;
  -ms-transform-origin: 100% 50%;
  transform-origin: 100% 50%;
}
.cd-section {
  height: 400px;
}
#landing-section {
  background: DarkCyan;
}
#biography-section {
  background: CornflowerBlue;
}
#recordings-section {
  background: OrangeRed;
}
#gallery-section {
  background: Coral;
}
#contact-section {
  background: MediumPurple;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<div class="main-header-container">
  <header>

    <nav class="menu clearfix" id="main-nav">
      <ul class="menu__list">

        <li class="menu__item menu__item--current" id="news">
          <a class="menu__link" href="#landing-section" data-number="1">News</a>
        </li>
        <li class="menu__item" id="biography">
          <a class="menu__link" href="#biography-section" data-number="2">Biography</a>
        </li>
        <li class="menu__item" id="recordings">
          <a class="menu__link" href="#recordings-section" data-number="3">Recordings</a>
        </li>
        <li class="menu__item" id="gallery">
          <a class="menu__link" href="#gallery-section" data-number="4">Gallery</a>
        </li>
        <li class="menu__item" id="contact">
          <a class="menu__link" href="#contact-section" data-number="5">Contact</a>
        </li>

      </ul>
    </nav>
  </header>
</div>
<nav id="cd-vertical-nav">
  <ul>
    <li id="vertical-nav1">
      <a href="#landing-section" data-number="1">
        <span class="cd-dot"></span>
        <span class="cd-label">News</span>
      </a>
    </li>
    <li id="vertical-nav2">
      <a href="#biography-section" data-number="2">
        <span class="cd-dot"></span>
        <span class="cd-label">Biography</span>
      </a>
    </li>
    <li id="vertical-nav3">
      <a href="#recordings-section" data-number="3">
        <span class="cd-dot"></span>
        <span class="cd-label">Recordings</span>
      </a>
    </li>
    <li id="vertical-nav4">
      <a href="#gallery-section" data-number="4">
        <span class="cd-dot"></span>
        <span class="cd-label">Gallery</span>
      </a>
    </li>
    <li id="vertical-nav5">
      <a href="#contact-section" data-number="5">
        <span class="cd-dot"></span>
        <span class="cd-label">Contact</span>
      </a>
    </li>
  </ul>
</nav>

<section id="landing-section" class="cd-section"></section>
<section id="biography-section" class="cd-section"></section>
<section id="recordings-section" class="cd-section"></section>
<section id="gallery-section" class="cd-section"></section>
<section id="contact-section" class="cd-section"></section>

4 个答案:

答案 0 :(得分:0)

要选择多个元素,请将它们放在单个选择器字符串中,用逗号分隔,而不是var navigationItems = $('#cd-vertical-nav a, #main-nav a'); 函数的单独参数。

jQuery

当你用多个参数调用$('#cd-vertical-nav a', '#main-nav a') 时,第一个参数是一个选择器,第二个参数是要在其中搜索的上下文,即

$('#main-nav a').find('#cd-vertical-nav a')

相当于

<nav class="menu clearfix fixed-nav" id="main-nav">
<nav class="fixed-nav" id="cd-vertical-nav">

另一种以更一般的方式执行此操作的方法是使用类。

$('.fixed-nav a')

然后您可以使用val result = mongocollection.find(MongoDBObject("index_column"-> "site_id")).one() println(result.get("mapped_column"))

答案 1 :(得分:0)

您需要使用mutliplse selector syntax

jQuery(document).ready(function($) {
  var contentSections = $('.cd-section'),
    navigationItems = $('#cd-vertical-nav a, #main-nav a');

  updateNavigation();
  $(window).on('scroll', function() {
    updateNavigation();
  });

  //smooth scroll to the section
  navigationItems.on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });
  //smooth scroll to second section
  $('.arrow-down').on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });

  //open-close navigation on touch devices
  $('.touch .cd-nav-trigger').on('click', function() {
    $('.touch #cd-vertical-nav').toggleClass('open');

  });
  //close navigation on touch devices when selectin an elemnt from the list
  $('.touch #cd-vertical-nav a').on('click', function() {
    $('.touch #cd-vertical-nav').removeClass('open');
  });

  function updateNavigation() {
    contentSections.each(function() {
      $this = $(this);
      var activeSection = $('#cd-vertical-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
      if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
        navigationItems.eq(activeSection).addClass('is-selected');
      } else {
        navigationItems.eq(activeSection).removeClass('is-selected');
      }
    });
  }

  function smoothScroll(target) {
    console.log('x', target.get())
    $('body,html').animate({
        'scrollTop': target.offset().top - 120
      },
      1500, 'easeOutExpo'
    );
  }
});

如果您将第二个选择器作为单独的参数传递,那么它将被视为context parameter

.main-header-container {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 9999;
}
header {
  background: DarkGray;
}
a {
  text-decoration: none;
  color: white;
}
li {
  list-style-type: none;
}
.menu {
  line-height: 1.5;
  margin: auto;
}
.menu,
.menu__list {
  padding: 0;
}
.menu__list {
  position: relative;
  display: -webkit-flex;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0;
  list-style: none;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.menu__item {
  display: block;
  margin: 1em 0;
}
.menu__link {
  color: white;
  text-transform: uppercase;
  letter-spacing: 2.3px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 600;
  display: block;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  position: relative;
  margin: 0 1em;
  padding: 0.75em 0;
  text-align: center;
  -webkit-transition: color 0.3s;
  transition: color 0.3s;
}
.menu__link:hover,
.menu__link:focus {
  outline: none;
  color: yellow;
}
.menu__item--current .menu__link {
  color: yellow;
}
.menu__link::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 3px;
  width: 100%;
  height: 2px;
  background: yellow;
  -webkit-transform: scale3d(0, 1, 1);
  transform: scale3d(0, 1, 1);
  -webkit-transition: -webkit-transform 0.1s;
  transition: -webkit-transform 0.1s;
  transition: transform 0.1s;
  transition: transform 0.1s, -webkit-transform 0.1s;
}
.menu__item--current .menu__link::before {
  -webkit-transform: scale3d(1, 1, 1);
  transform: scale3d(1, 1, 1);
  -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
/****Vertical Nav Styles****/

#cd-vertical-nav {
  position: fixed;
  right: 40px;
  top: 50%;
  bottom: auto;
  z-index: 9999;
  -webkit-transform: translate3d(0, -50%, 0);
  transform: translate3d(0, -50%, 0);
}
#cd-vertical-nav li {
  text-align: right;
}
#cd-vertical-nav a {
  display: inline-block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
#cd-vertical-nav a:after {
  content: "";
  display: table;
  clear: both;
}
#cd-vertical-nav a span {
  float: right;
  display: inline-block;
  -webkit-transform: scale(0.6);
  -ms-transform: scale(0.6);
  transform: scale(0.6);
}
#cd-vertical-nav a:hover span {
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav a:hover .cd-label {
  opacity: 1;
}
#cd-vertical-nav a.is-selected .cd-dot {
  background-color: white;
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav .cd-dot {
  position: relative;
  top: 8px;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background-color: white;
  -webkit-transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.3s;
  transition: transform 0.5s, background-color 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.3s;
  -webkit-transform-origin: 50% 50%;
  -ms-transform-origin: 50% 50%;
  transform-origin: 50% 50%;
}
#cd-vertical-nav .cd-label {
  position: relative;
  margin-right: 10px;
  padding: .4em .5em;
  color: white;
  font-size: 14px;
  font-size: 0.875rem;
  letter-spacing: 1.3px;
  font-weight: 400;
  -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: transform 0.3s, opacity 0.3s;
  transition: transform 0.3s, opacity 0.3s, -webkit-transform 0.3s;
  opacity: 0;
  -webkit-transform-origin: 100% 50%;
  -ms-transform-origin: 100% 50%;
  transform-origin: 100% 50%;
}
.cd-section {
  height: 400px;
}
#landing-section {
  background: DarkCyan;
}
#biography-section {
  background: CornflowerBlue;
}
#recordings-section {
  background: OrangeRed;
}
#gallery-section {
  background: Coral;
}
#contact-section {
  background: MediumPurple;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<div class="main-header-container">
  <header>

    <nav class="menu clearfix" id="main-nav">
      <ul class="menu__list">

        <li class="menu__item menu__item--current" id="news">
          <a class="menu__link" href="#landing-section" data-number="1">News</a>
        </li>
        <li class="menu__item" id="biography">
          <a class="menu__link" href="#biography-section" data-number="2">Biography</a>
        </li>
        <li class="menu__item" id="recordings">
          <a class="menu__link" href="#recordings-section" data-number="3">Recordings</a>
        </li>
        <li class="menu__item" id="gallery">
          <a class="menu__link" href="#gallery-section" data-number="4">Gallery</a>
        </li>
        <li class="menu__item" id="contact">
          <a class="menu__link" href="#contact-section" data-number="5">Contact</a>
        </li>

      </ul>
    </nav>
  </header>
</div>
<nav id="cd-vertical-nav">
  <ul>
    <li id="vertical-nav1">
      <a href="#landing-section" data-number="1">
        <span class="cd-dot"></span>
        <span class="cd-label">News</span>
      </a>
    </li>
    <li id="vertical-nav2">
      <a href="#biography-section" data-number="2">
        <span class="cd-dot"></span>
        <span class="cd-label">Biography</span>
      </a>
    </li>
    <li id="vertical-nav3">
      <a href="#recordings-section" data-number="3">
        <span class="cd-dot"></span>
        <span class="cd-label">Recordings</span>
      </a>
    </li>
    <li id="vertical-nav4">
      <a href="#gallery-section" data-number="4">
        <span class="cd-dot"></span>
        <span class="cd-label">Gallery</span>
      </a>
    </li>
    <li id="vertical-nav5">
      <a href="#contact-section" data-number="5">
        <span class="cd-dot"></span>
        <span class="cd-label">Contact</span>
      </a>
    </li>
  </ul>
</nav>

<section id="landing-section" class="cd-section"></section>
<section id="biography-section" class="cd-section"></section>
<section id="recordings-section" class="cd-section"></section>
<section id="gallery-section" class="cd-section"></section>
<section id="contact-section" class="cd-section"></section>
javascript

答案 2 :(得分:0)

试试这个

myhostname              = travelinsurancequotes.com.au
mydomain                = travelinsurancequotes.com.au
inet_interfaces = all

mynetworks_style        = host
local_destination_recipient_limit       = 300
local_destination_concurrency_limit     = 5
recipient_delimiter=+

smtpd_banner            = $myhostname

smtpd_sasl_auth_enable          = yes
smtp_sasl_mechanism_filter = plain
smtpd_sasl_local_domain         = $myhostname
broken_sasl_auth_clients        = yes
smtpd_helo_required             = yes
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/sslcerts/server.key
smtpd_tls_cert_file = /etc/postfix/sslcerts/server.crt
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

relayhost = [email-smtp.us-west-2.amazonaws.com]:25
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

答案 3 :(得分:0)

我尝试更改jQuery(请参阅更新的代码段),以便根据滚动位置将类添加到每个导航的活动链接。 这里一定有问题(也在其他地方?):

updateMainNavigation()
updateVerticalNavigation() 

这里它们以逗号分隔,但我也尝试编写两个完全不同的函数,即使行为是相同的。我无法弄清楚我应该做些什么才能让它发挥作用。 我和昨天一样,并且欢迎任何帮助!

jQuery(document).ready(function($) {
  var contentSections = $('.cd-section'),
    navigationItems = $('.fixed-nav a');

  updateMainNavigation(), updateVerticalNavigation();
  $(window).on('scroll', function() {
    updateMainNavigation(), updateVerticalNavigation();
  });

  //smooth scroll to the section
  navigationItems.on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });
  //smooth scroll to second section
  $('.arrow-down').on('click', function(event) {
    event.preventDefault();
    smoothScroll($(this.hash));
  });

  function updateMainNavigation() {
    contentSections.each(function() {
      $this = $(this);
      var activeSection = $('#main-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
      if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
        navigationItems.eq(activeSection).addClass('menu__item--current');
      } else {
        navigationItems.eq(activeSection).removeClass('menu__item--current');
      }
    });
  }

  function updateVerticalNavigation() {
    contentSections.each(function() {
      $this = $(this);
      var activeSection = $('#cd-vertical-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
      if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
        navigationItems.eq(activeSection).addClass('is-selected');
      } else {
        navigationItems.eq(activeSection).removeClass('is-selected');
      }
    });
  }

  function smoothScroll(target) {
    $('body,html').animate({
        'scrollTop': target.offset().top - 120
      },
      1500, 'easeOutExpo'
    );
  }
});
.main-header-container {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 9999;
}
header {
  background: DarkGray;
}
a {
  text-decoration: none;
  color: white;
}
li {
  list-style-type: none;
}
.menu {
  line-height: 1.5;
  margin: auto;
}
.menu,
.menu__list {
  padding: 0;
}
.menu__list {
  position: relative;
  display: -webkit-flex;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0;
  list-style: none;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.menu__item {
  display: block;
  margin: 1em 0;
}
.menu__link {
  color: white;
  text-transform: uppercase;
  letter-spacing: 2.3px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 600;
  display: block;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  position: relative;
  margin: 0 1em;
  padding: 0.75em 0;
  text-align: center;
  -webkit-transition: color 0.3s;
  transition: color 0.3s;
}
.menu__link:hover,
.menu__link:focus {
  outline: none;
  color: yellow;
}
.menu__item--current .menu__link {
  color: yellow;
}
.menu__link::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 3px;
  width: 100%;
  height: 2px;
  background: yellow;
  -webkit-transform: scale3d(0, 1, 1);
  transform: scale3d(0, 1, 1);
  -webkit-transition: -webkit-transform 0.1s;
  transition: -webkit-transform 0.1s;
  transition: transform 0.1s;
  transition: transform 0.1s, -webkit-transform 0.1s;
}
.menu__item--current .menu__link::before {
  -webkit-transform: scale3d(1, 1, 1);
  transform: scale3d(1, 1, 1);
  -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
/****Vertical Nav Styles****/

#cd-vertical-nav {
  position: fixed;
  right: 40px;
  top: 50%;
  bottom: auto;
  z-index: 9999;
  -webkit-transform: translate3d(0, -50%, 0);
  transform: translate3d(0, -50%, 0);
}
#cd-vertical-nav li {
  text-align: right;
}
#cd-vertical-nav a {
  display: inline-block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
#cd-vertical-nav a:after {
  content: "";
  display: table;
  clear: both;
}
#cd-vertical-nav a span {
  float: right;
  display: inline-block;
  -webkit-transform: scale(0.6);
  -ms-transform: scale(0.6);
  transform: scale(0.6);
}
#cd-vertical-nav a:hover span {
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav a:hover .cd-label {
  opacity: 1;
}
#cd-vertical-nav a.is-selected .cd-dot {
  background-color: white;
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
#cd-vertical-nav .cd-dot {
  position: relative;
  top: 8px;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background-color: white;
  -webkit-transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.5s;
  transition: background-color 0.5s, transform 0.5s, -webkit-transform 0.3s;
  transition: transform 0.5s, background-color 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.5s;
  transition: transform 0.5s, background-color 0.5s, -webkit-transform 0.3s;
  -webkit-transform-origin: 50% 50%;
  -ms-transform-origin: 50% 50%;
  transform-origin: 50% 50%;
}
#cd-vertical-nav .cd-label {
  position: relative;
  margin-right: 10px;
  padding: .4em .5em;
  color: white;
  font-size: 14px;
  font-size: 0.875rem;
  letter-spacing: 1.3px;
  font-weight: 400;
  -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: opacity 0.3s, -webkit-transform 0.3s;
  transition: transform 0.3s, opacity 0.3s;
  transition: transform 0.3s, opacity 0.3s, -webkit-transform 0.3s;
  opacity: 0;
  -webkit-transform-origin: 100% 50%;
  -ms-transform-origin: 100% 50%;
  transform-origin: 100% 50%;
}
.cd-section {
  height: 400px;
}
#landing-section {
  background: DarkCyan;
}
#biography-section {
  background: CornflowerBlue;
}
#recordings-section {
  background: OrangeRed;
}
#gallery-section {
  background: Coral;
}
#contact-section {
  background: MediumPurple;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<div class="main-header-container">
  <header>

    <nav class="menu clearfix" id="main-nav">
      <ul class="menu__list">

        <li class="menu__item menu__item--current" id="news">
          <a class="menu__link" href="#landing-section" data-number="1">News</a>
        </li>
        <li class="menu__item" id="biography">
          <a class="menu__link" href="#biography-section" data-number="2">Biography</a>
        </li>
        <li class="menu__item" id="recordings">
          <a class="menu__link" href="#recordings-section" data-number="3">Recordings</a>
        </li>
        <li class="menu__item" id="gallery">
          <a class="menu__link" href="#gallery-section" data-number="4">Gallery</a>
        </li>
        <li class="menu__item" id="contact">
          <a class="menu__link" href="#contact-section" data-number="5">Contact</a>
        </li>

      </ul>
    </nav>
  </header>
</div>
<nav id="cd-vertical-nav">
  <ul>
    <li id="vertical-nav1">
      <a href="#landing-section" data-number="1">
        <span class="cd-dot"></span>
        <span class="cd-label">News</span>
      </a>
    </li>
    <li id="vertical-nav2">
      <a href="#biography-section" data-number="2">
        <span class="cd-dot"></span>
        <span class="cd-label">Biography</span>
      </a>
    </li>
    <li id="vertical-nav3">
      <a href="#recordings-section" data-number="3">
        <span class="cd-dot"></span>
        <span class="cd-label">Recordings</span>
      </a>
    </li>
    <li id="vertical-nav4">
      <a href="#gallery-section" data-number="4">
        <span class="cd-dot"></span>
        <span class="cd-label">Gallery</span>
      </a>
    </li>
    <li id="vertical-nav5">
      <a href="#contact-section" data-number="5">
        <span class="cd-dot"></span>
        <span class="cd-label">Contact</span>
      </a>
    </li>
  </ul>
</nav>

<section id="landing-section" class="cd-section"></section>
<section id="biography-section" class="cd-section"></section>
<section id="recordings-section" class="cd-section"></section>
<section id="gallery-section" class="cd-section"></section>
<section id="contact-section" class="cd-section"></section>