博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
github 滑动删除_GitHub风格的滑动链接
阅读量:2520 次
发布时间:2019-05-11

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

github 滑动删除

GitHub seems to change a lot but not really change at all, if that makes any sense; the updates come often but are always fairly small. I spotted one of the most recent updates on the pull request page. Links to long branch names now have their text visually truncated, and upon hover, the text animates to its full value. The CSS to accomplish this task is fairly simple, so let me show you how to make this happen!

GitHub似乎有很大的变化,但如果有任何意义,则根本没有真正的变化。 更新经常出现,但总是很小。 我在拉取请求页面上发现了最新更新之一。 现在,指向长分支名称的链接在视觉上被截断,并且悬停时,该文本会动画显示其完整值。 完成此任务CSS非常简单,所以让我向您展示如何实现这一目标!

HTML (The HTML)

Adding an A element is obvious but less obvious is that the element must be wrapped with another element (you'll see why in the CSS section):

添加一个A元素是显而易见的,但不太明显的是该元素必须用另一个元素包装(您将在CSS部分中看到原因):

Pull request from: david-walsh-test-branch-name

Simples.

简单。

CSS (The CSS)

The wrapping element requires a max-width and position of relative:

包装元素需要max-widthrelative position

.github-branch-wrap {	max-width:690px;	position:relative;}

The animation centers around CSS transitions and the max-width property paired with overflow:

动画围绕CSS过渡和max-width属性与溢出配对:

.github-branch {	position: relative;	height: 24px;	display: inline-block;	top: 7px;	padding: 0 7px;	background: #444;	background: -moz-linear-gradient(#444, #222);	background: -webkit-linear-gradient(#444, #222);	-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444',endColorstr='#222222')";	border: 1px solid black;	border-radius: 3px;	color: white;	font-family: Consolas,"Liberation Mono",Courier,monospace;	font-size: 13px;	line-height: 24px;	text-overflow: ellipsis;	overflow: hidden;	white-space: nowrap;	vertical-align: top;	z-index: 100;		max-width: 125px;	transition: .2s max-width linear;	-o-transition: .2s max-width linear;	-moz-transition: .2s max-width linear;	-webkit-transition: .2s max-width linear;	-ms-transition: .2s max-width linear;}/* Transition to complete width! */.github-branch:hover, .github-branch:active {	max-width: inherit;}

Also note the nice touch of text-overflow:ellipsis -- this adds the "..." during the plain state.

还要注意text-overflow:ellipsis -在纯text-overflow:ellipsis状态下添加了“ ...”。

I didn't like the effect at first, but it's grown on me, and actually does have some value. There's definitely some clever thought behind the effect, and it's the the type of effect I admire: simple but purposeful. Well done GitHub devs!

一开始我不喜欢这种效果,但是这种效果在我身上逐渐形成,并且确实具有一定的价值。 效果背后肯定有一些聪明的想法,这是我欣赏的效果类型:简单但有目的。 GitHub开发人员做得好!

翻译自:

github 滑动删除

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

你可能感兴趣的文章
hMailServer搭建简单邮件系统
查看>>
从零开始学习jQuery
查看>>
Spring+SpringMVC+MyBatis深入学习及搭建(四)——MyBatis输入映射与输出映射
查看>>
opacity半透明兼容ie8。。。。ie8半透明
查看>>
CDOJ_24 八球胜负
查看>>
Alpha 冲刺 (7/10)
查看>>
一款jQuery打造的具有多功能切换的幻灯片特效
查看>>
SNMP从入门到开发:进阶篇
查看>>
@ServletComponentScan ,@ComponentScan,@Configuration 解析
查看>>
unity3d 射弹基础案例代码分析
查看>>
thinksns 分页数据
查看>>
os模块
查看>>
LINQ to SQL vs. NHibernate
查看>>
基于Angular5和WebAPI的增删改查(一)
查看>>
windows 10 & Office 2016 安装
查看>>
最短路径(SP)问题相关算法与模板
查看>>
js算法之最常用的排序
查看>>
Python——交互式图形编程
查看>>
经典排序——希尔排序
查看>>
团队编程项目作业2-团队编程项目代码设计规范
查看>>