- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试为 glyphicon-refresh
图标制作动画,这样当我点击该图标时它应该会旋转。我正在尝试使用 CSS3 执行此操作,但它无法正常工作。
这是我的标记:
<a id="update" href="#"><i class="glyphicon glyphicon-refresh"></i></a>
这是我的CSS:
<style>
.glyphicon-refresh-animate {
animation-name: rotateThis;
animation-duration: .5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes "rotateThis" {
from { transform: scale( 1 ) rotate( 0deg ); }
to { transform: scale( 1 ) rotate( 360deg ); }
}
</style>
这是我的 JS:
<script type="text/javascript">
$( document ).ready( function() {
$( "#update" ).on( "click", function( e ) {
var $icon = $( this ).find( ".glyphicon glyphicon-refresh" ),
animateClass = "glyphicon-refresh-animate";
$icon.addClass( animateClass );
// setTimeout is to indicate some async operation
window.setTimeout( function() {
$icon.removeClass( animateClass );
}, 2000 );
});
});
</script>
如有任何帮助或替代方法,我们将不胜感激。
最佳答案
首先:你的 jQuery 选择器是错误的:
.glyphicon glyphicon-refresh
必须是
.glyphicon.glyphicon-refresh
其次:您应该为所有 animate
属性、keyframes
关键字和 transform
属性加上 vendor 前缀。 (仅 Firefox 和 IE10+ 支持不带前缀。http://caniuse.com/#feat=css-animation)例如 Safari 和 Chrome:
.glyphicon-refresh-animate {
-webkit-animation-name: rotateThis;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes "rotateThis" {
from {
-webkit-transform: rotate( 0deg );
}
to {
-webkit-transform: rotate( 360deg );
}
}
http://jsfiddle.net/DX4AJ/这个 fiddle 只适用于 Safari 和 Chrome!
关于javascript - 单击动画 Glyphicon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22502598/
我想使用微调器来刷新数据。我已经使用了上面的代码。 数据正在刷新。但是图标没有旋转。 最佳答案 尝试使
我是 pug 的新手,想在“所有月份”的下拉菜单中添加 glyphicon glyphicon-calendar 吗? .pull-right select.form-control.btn-p
我正在使用 Bootstrap 3.0,我正在使用 Twitter Bootstrap Glyphicons .我正在尝试使用“glyphicon glyphicon-plus”,但是当我放入类时,它
当鼠标悬停在字形标志上时,我显示一些信息。该代码现在可以运行,但仅适用于添加内容。我想使用相同的 JQuery 代码进行编辑、删除等。我不想一次又一次地重复 Jquery 代码。 如何做到这一点? H
根据他们的指南,这太奇怪了 here ,我添加了一个带有 glyphicon glyphicon-cog 的跨度......但是,当加载我的页面时,它实际上显示了信封 - 这是 glyphicon g
我正在使用 angular-cli 和 bootstrap4 做一个应用程序,但是当我对 Glyphicons 进行一些引用时,图标不会出现。例如,当我添加以下代码时: Star 我在我的角
如何去除白色背景?我已经设置了 background-color:transparent 但仍然有白色背景。 这是一张图片: 我的 HTML 代码: 这是我的 CSS: .glyphicon-th-
我尝试使用图标 glyphicon glyphicon-chevron-right 在我的设计中显示方向,但我需要比默认尺寸更细的图标。那么如何减少 glyphicon glyphicon-chevr
我已经购买了完整的 Glyphicons PRO 包,并希望将它与 Bootstrap 3 一起使用。 但是,我似乎无法找到有关如何执行此操作的全面文档。 Glyphicons 网站缺少“如何使用部分
如何从 yii2 中的特定页面中删除 glyph-icon-pencil 和 glyph-icon 垃圾 最佳答案 您可以在 actionColumn 中使用模板 $dataProvider,
我正在将 jquery-validation 与 glyphicons 集成。基本上,当用户正确输入内容时,我希望在输入框中看到字形图标,如下所示: 但我希望它成为通过 CSS :after 属性触发
比较 http://fiddle.jshell.net/R3qEn/6/和 http://fiddle.jshell.net/R3qEn/7/ - 唯一的区别是 css-frame 的第一行 - 我们
字形图标显示在按钮文本上方。我尝试使用 vertical-align: middle; 但它仍然不起作用。 代码: " . $_SESSION['
我正在使用 Bootstrap3 字形图标。例如 我希望它是绿色的,所以我使用了一个名为 public 的类: .public { color:green; } 当我将此应用于图标时,它不起
在我的电脑上,运行 Visual Studio,运行完美... 但是,当我将它部署到我的服务器时,并没有呈现 Glyphicons...谁知道可以是什么? Site that isn't workin
我尝试将 bootstrap datetimepicker 与 glyphicon 日历一起使用。但是如果我点击选择器,什么也不会发生。 连日历都打不开。我在我的 .jsp 页面中添加了以下 .js
如何在此列表中将我的 Glyphicons 垂直和水平居中(跨浏览器)? 我的 CSS 根本没有让元素居中。 它的样子: 它应该是什么样子:
我正在尝试修复我的字形。每当加载页面时,它们都会移动并在很短的时间后出现,但我的导航因此而摇晃。 有人对此有解决方案或经验吗? 下面是我如何加载字体的代码: @font-face { font
我在 bootstrap v3.3.5 上使用 bootstrap.min.css。我从 http://getbootstrap.com 下载 Bootstrap 并在本地使用它。我注意到在 IE 9
我从这个 link 下载了 Bootstrap v3.1.1 .我在我的 ASP.NET MVC 元素中使用 Glyphicon。 我面临的问题是,在我看来,我有时可以看到 Glyphicon 图标,
我是一名优秀的程序员,十分优秀!