JS Scroller不能顺利滚动

时间:2016-12-14 21:28:34

标签: javascript jquery html css

大家好,我们在这里有首页:http://wp.partyloo.com/

我向它添加了一个向下滚动箭头,向下滚动它下面的下一部分。

我收到了以下HTML:

   <a id="scroll" href="#second"><i class="fa fa-angle-down" style="font-size:54px; color: #fff; text-align: center; display: block; margin: 0 auto;" aria-hidden="true"></i></a>

这是我放置的JS:

$('a[href*="#"]:not([href="#"])').click(function() {
  if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
    var target = $(this.hash);
    target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
    if (target.length) {
      $('html, body').animate({
        scrollTop: target.offset().top
      }, 600);
      return false;
    }
  }
});

现在,当您单击箭头时,它不会顺利向下滚动。单击它时,只会自动转到下一个div / section。

如何制作一些流畅的动画,使其顺畅而顺畅地向下滚动?

提前感谢!

1 个答案:

答案 0 :(得分:0)

我觉得你需要这个吗?

http://www.w3schools.com/css/css3_transitions.asp

Client client = ClientProxy.getClient(port);

// Add HTTP headers to the web service request
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Authorization", Arrays.asList(authorization));
headers.put("clientid", Arrays.asList(clientid));
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);

// Add SOAP headers
List<Header> soapheaders = new ArrayList<Header>();
Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"), "decapitated", new JAXBDataBinding(String.class));
soapheaders.add(dummyHeader);
client.getRequestContext().put(Header.HEADER_LIST, soapheaders);