我正在尝试创建一个固定的导航栏,它在向下滚动时隐藏,在向上滚动时重新显示。
我的导航栏从顶部算起的位置是37.5px,当我向上滚动时,如果我在页面的中间,我希望它位于页面的顶部。
这是我尝试过的方法。
CSS
.nav-up
top -80px
background-color #8fd0f3
.nav-down
top 0
.navbar-wrapper
position fixed
// top -7px
top 37.5px
// -webkit-transform translateY(37.5px)
z-index 10
我试图有一个单一的链接滚动到两个不同的点,在两个不同的溢出div。
也许更清楚地解释了我想要做的事情。
<div id="small-box-links">
<a href="#small-box1">Link to small-box #1 and #5</a>
<a href="#small-box2">Link to small-box #2 and #4</a>
<a href="#small-box3">Link to s
我试图在JS中实现模块模式,但是滚动事件没有触发,代码有什么问题,下面是示例
var modBrandHeader = (function ($) {
'use strict';
var $con;
/* GENERIC */
var init = function () {
$con = $('.brand-header');
if (!$con.length) {
return;
}
};
var scroll = function (scr
我在functions.php文件中加载jQuery和main.js文件,如下所示:
function my_scripts() {
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http"