如何在标题后立即停止滚动?

时间:2016-02-22 18:44:13

标签: javascript jquery html

我有这个网站:

link

代码HTML:

 <div class="col-md-12 text-center img-scroll">
            <img src="wp-content/uploads/2015/10/scroll.png" >
        </div>

CODE JS:

$(window).scroll(function() {
    var scroll = $(window).scrollTop();
    console.log("scroll-ul este:",scroll);
    $(".img-scroll img").click(function() {
        debugger;
        var scroll = $(window).scrollTop();
        var const_header=$(".about-content-top").outerHeight();
        var result=const_header-scroll;
        if(scroll<const_header){
            $('html, body').animate({
                scrollTop: $(window).scrollTop() + result
            });
        }else{
            console.log("mata");
        }
        console.log("headerul este:",const_header);
    });
});

我想要做的是当用户点击图片时,滚动到标题

下面

我放了一张照片,以便更清楚地了解他们想要做什么

你能告诉我为什么我的职位对我的职能不好吗? 不要做我需要的......

提前致谢!

enter image description here

0 个答案:

没有答案
相关问题