Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何添加向下推动页面的箭头?_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 如何添加向下推动页面的箭头?

Javascript 如何添加向下推动页面的箭头?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我正在创建一个站点,它看起来与此站点类似。正如您在示例中所看到的,有一个动画箭头,如果按下该箭头,将向下移动。这种方式有点突然,所以动画向下移动会很酷。我更关注页面向下移动的方式,而不是动画箭头。你知道如何在html和css中实现这一点吗?如果这不能用html或css来完成,那么jQuery可以吗 例如: 对于down: $( "#test" ).click(function() { scrolled=scrolled-300; $("body").anima

我正在创建一个站点,它看起来与此站点类似。正如您在示例中所看到的,有一个动画箭头,如果按下该箭头,将向下移动。这种方式有点突然,所以动画向下移动会很酷。我更关注页面向下移动的方式,而不是动画箭头。你知道如何在html和css中实现这一点吗?如果这不能用html或css来完成,那么jQuery可以吗

例如:

对于down:

$( "#test" ).click(function() {
        scrolled=scrolled-300;
         $("body").animate({
      scrollTop:  scrolled
       });
  });

如何将其链接到我的html并使其正常工作?在
标记中添加jQuery脚本,并添加一个按钮,通过该按钮可以滚动。我希望能够单击并显示将向下移动页面的图像。但是它不起作用吗?我可以用这段代码来完成-->$(function(){$('a[href*=\\\\]:not([href=\\]])。单击(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},1000);return false;}}}}});它会将页面向下移动到另一个“部分”然而,我想使该部分更长,然后当该部分更长时,它会错误地向下滚动进一步。
$( "#test" ).click(function() {
     var x = $(window).scrollTop();  
     $(window).scrollTop(x+150);
 });
$( "#test" ).click(function() {
        scrolled=scrolled-300;
         $("body").animate({
      scrollTop:  scrolled
       });
  });