博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[AngularJS] Using $anchorScroll
阅读量:6940 次
发布时间:2019-06-27

本文共 1070 字,大约阅读时间需要 3 分钟。

If you're in a scenario where you want to disable the auto scrolling, but you want to control the scrolling manually, you can use the anchorscroll service, and then just invoke that after some hash has changed.

 

    
{
{elm}}
{
{elm}}
var app = angular.module("egghead", []);app.config(function ($anchorScrollProvider) {    $anchorScrollProvider.disableAutoScrolling();})app.controller("AppCtrl", function ($location, $anchorScroll) {    var app = this;    app.elms = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");    //https://github.com/bgrins/TinyColor#color-combinations    var colors = tinycolor.analogous("steelblue", app.elms.length, app.elms.length);    app.goToAnchor = function (elm) {        $location.hash(elm); //call when you when it scroll        $anchorScroll();    }    app.createStyle = function (index) {        var color = colors[index]; //grabs a tinycolor of the array        return {            backgroundColor: color.toHexString(),            borderBottom: "3px solid black",            height: "100px"        };    }})

 

转载地址:http://jkinl.baihongyu.com/

你可能感兴趣的文章
spring源码分析(一)资源文件的加载
查看>>
基于卷积神经网络的以图搜图算法实现
查看>>
同步与异步的区别
查看>>
SQL获取上月第一天和最后一天
查看>>
填报表更新时去除重复数据
查看>>
淘宝分词怎么查看,详谈淘宝分词原则
查看>>
对于sqli-labs基础篇全程使用sqlmap不用手工注入(七夕礼物!!!)
查看>>
C++雾中风景11:厘清C++类型转换(static_cast,dynamic_cast,reinterpret_cast,const_cast)
查看>>
为什么开发人员必须要了解数据库锁?
查看>>
Lua 学习笔记(二)—— 语句
查看>>
制作自己的Vagrant Box
查看>>
NetCore实践篇:分布式监控客户端ZipkinTracer从入门到放弃之路
查看>>
JAVA学习摘要
查看>>
[Java开发之路](23)装箱与拆箱
查看>>
TextView实现跑马灯效果
查看>>
Mysql字段名与保留字冲突导致的异常解决
查看>>
Rust 1.33.0 发布,OSC 上堪称“零差评”的编程语言
查看>>
Android MotionEvent详解
查看>>
单例模式
查看>>
现在到底还该不该买房?
查看>>