小编Eri*_*son的帖子

粘滞的标题滚动问题

我在网站上有一个粘性标题.但是当视口底部下方有一个非常特定数量的内容(大约等于我的html上的2-3x padding-top)时,如果试图慢慢滚动,则滚动会上下振动.如果页面下方有大量内容,则效果很好.

编辑:对不起,如果我的原始问题不够清楚,但我希望整个页面滚动,直到'标题'到达屏幕顶部,然后(并且只有那时)让标题停止滚动,而页面的其余内容继续滚动它.

这是一个JSfiddle

$(function () {
    // Check the initial Poistion of the Sticky Header
    var stickyHeaderTop = $('#stickyheader').offset().top;

    $(window).scroll(function () {
        if ($(window).scrollTop() > stickyHeaderTop) {
            $('#stickyheader').css({
                position: 'fixed',
                top: '0px'
            });
            $('#othercontent').css('margin-top', $('#stickyheader').outerHeight(true));
        } else {
            $('#stickyheader').css({
                position: 'static',
                top: '0px'
            });
            $('#othercontent').css('margin-top', '0px');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)
body {
    font: 13px sans-serif;
    padding-top: 20px;
}
#stickyheader {
    width: 100%;
    height: 40px;
    background:black;
    color:white;
    margin-bottom: 10px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="stickyheader">Sticky header</div>
<div id="othercontent">
<p>Lorem ipsum dolor …
Run Code Online (Sandbox Code Playgroud)

html css jquery scroll

11
推荐指数
1
解决办法
550
查看次数

SQL Server导入向导将NULL视为文字字符串'NULL'

当我尝试将.csv逗号分隔的平面文件导入Microsoft SQL Server 2008R2 64位实例时,对于字符串列,原始数据中的NULL变为文字字符串"NULL",并且在数字列中我收到导入错误.谁能请帮忙??? 提前致谢!

sql-server csv import null flat-file

3
推荐指数
2
解决办法
1万
查看次数

代码仅在保留未使用的数组时有效

我有一个int ofd[4]我不再在我的代码中使用的数组.但是,如果我将其注释掉,我的代码将不再有效 - 我在stdout上没有输出并且文件已创建,但为空.

要观察此行为,请编译并运行代码 ./manatee /bin/ls -l /usr/bin/sort -r out.txt

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

#define READ_STDIN    0
#define READ_STDOUT   1
#define WRITE_STDIN   2
#define WRITE_STDOUT  3
#define NUM_PIPES     4

int pipes[NUM_PIPES][2];

#define READ_FD  0
#define WRITE_FD 1

void closeThePipes() {
    close(pipes[READ_STDIN][READ_FD]);
    close(pipes[READ_STDOUT][WRITE_FD]);
    close(pipes[READ_STDOUT][READ_FD]);
    close(pipes[READ_STDIN][WRITE_FD]);
    close(pipes[WRITE_STDIN][READ_FD]);
    close(pipes[WRITE_STDOUT][WRITE_FD]);
    close(pipes[WRITE_STDOUT][READ_FD]);
    close(pipes[WRITE_STDIN][WRITE_FD]);
}

int main(int argc, char ** argv) {
    if (argc != 6) {
        exit(1);
    }

    pipe(pipes[READ_STDOUT]);
    pipe(pipes[READ_STDIN]);
    pipe(pipes[WRITE_STDOUT]);
    pipe(pipes[WRITE_STDIN]);

    int ofd[4];

    if (!fork()) {
        dup2(pipes[READ_STDIN][READ_FD], STDIN_FILENO);
        dup2(pipes[READ_STDOUT][WRITE_FD], …
Run Code Online (Sandbox Code Playgroud)

c

1
推荐指数
1
解决办法
54
查看次数

标签 统计

c ×1

css ×1

csv ×1

flat-file ×1

html ×1

import ×1

jquery ×1

null ×1

scroll ×1

sql-server ×1