[英]jQuery.LocalScroll not working with cloned menu
I am using jQuery.LocalScroll plugin to allow my website visitors to navigate my site with a smooth scrolling effect. 我正在使用jQuery.LocalScroll插件,以允许我的网站访问者以平滑的滚动效果浏览我的网站。 It's working great with original header menu. 原始标题菜单的效果很好。 But I am trying to function with cloned header. 但是我正在尝试使用克隆标题。 Here is the code: 这是代码:
$('.sf-menu').localScroll({lazy: true});
if($('header.header-sticky').length == 0) {
$('[data-sticky-header="true"]').before($('[data-sticky-header="true"]').clone().addClass("header-sticky"));
}
An here is the HTML Markup 这是HTML标记
<header class="op_style" data-sticky-header="true">
<div class="clearfix header-desktop">
<div class="large-3 medium-3 columns">
<div class="site-logo">
<h1><a href="#" rel="home">Logo</a></h1>
</div>
</div>
<div class="large-9 medium-9 columns">
<nav class="main-nav">
<ul id="menu-for-one-page-portfolio" class="sf-menu right">
<li><a href="#hello">Home</a></li>
<li><a href="#services">Services</a></li>
</ul>
</nav>
</div>
</div>
</header>
尝试使用.clone(true)-它克隆具有所有事件处理程序的元素
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.