Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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
Html 添加新元素时不滚动到页面底部_Html_Css_Angularjs - Fatal编程技术网

Html 添加新元素时不滚动到页面底部

Html 添加新元素时不滚动到页面底部,html,css,angularjs,Html,Css,Angularjs,在“容器”的最后一个子项上添加新元素时,会出现时间滚动。我想向下滚动,将新元素放到浏览器视图中 我试过用“$anchorScroll”,但没用 HTML <div class="galleryMenu"> <!-- <a class="live" ng-click="galleryMenu('live')" href="#">live</a> <a class="visual" ng-click="galleryMe

在“容器”的最后一个子项上添加新元素时,会出现时间滚动。我想向下滚动,将新元素放到浏览器视图中

我试过用“$anchorScroll”,但没用

HTML

<div class="galleryMenu">
        <!-- <a class="live" ng-click="galleryMenu('live')" href="#">live</a>
        <a class="visual" ng-click="galleryMenu('visual')" href="#">visuals</a> -->
        <a class="projects" ng-click="galleryMenu('projects')" href="#">projects</a> //clicking and calling galleryMenu function
</div>
<!-- Focus needs to be applied here, height of element is 180px -->
<div class="appGallery" ng-show="galleryShow" id="anchor3">
        <a ng-click="galleryChanger('prev')" class="prev" href="#">prev</a>
        <a ng-click="galleryChanger('next')" class="next"  href="#">next</a>
</div>

你不是创建了很多同名的锚吗?不,我只有一个。这是硬编码的。你会做小提琴吗???
"use strict";

angular.module("tcpApp")
    .run(['$anchorScroll', function($anchorScroll) {
        $anchorScroll.yOffset = 180; //running here.
    }])
    .controller("homeController", ['$scope','server', '$anchorScroll', '$location', function ($scope, server, $anchorScroll, $location) {

        $scope.galleryMenu = function (gallery) {

        var newHash = 'anchor3';
        if ($location.hash() !== newHash) {
          $location.hash('anchor3');
        } else {
          $anchorScroll();
        }

    }]);