目前我正在使用这种方法的类.
class TipInCellAnimator {
// placeholder for things to come -- only fades in for now
class func animate(cell:UITableViewCell) {
let view = cell.contentView
view.layer.opacity = 0.1
UIView.animateWithDuration(0.1) {
view.layer.opacity = 1
}
}
}
Run Code Online (Sandbox Code Playgroud)
并在我的主viewcontroller中调用它,如下所示
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell,
forRowAtIndexPath indexPath: NSIndexPath) {
TipInCellAnimator.animate(cell)
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,当重新加载项目时,单元格会闪烁,因为它正在淡入,我无法点击屏幕来停止滚动.
有没有人有关于如何解决这些问题或其他方法达到相同效果的一些提示?
我使用UITextView在ViewDidLoad()中显示长文本:
var story1 = "Researchers on Friday introduced the stunningly realistic-looking interactive humanoid robot to the world, and she reacted by nodding her head, squinting, moving her hand and eyeballs and telling assembled local photographers, with her speech synched to her lip movements, to snap her face from a more flattering angle. Girl's got spirit. \n\nJia Jia made her public debut at the University of Science and Technology of China, where she came to life over the course of three …Run Code Online (Sandbox Code Playgroud) 我在ListView内部使用NestedScrollView,但看不到超过1项ListView.我可以滚动到TextView(textContact)的末尾,但不能在ListView(listContact)内滚动.
这是.xml文件的代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
... >
<android.support.design.widget.CoordinatorLayout
... >
<LinearLayout
...
android:orientation="vertical">
<android.support.v7.widget.Toolbar
... />
<android.support.v4.widget.NestedScrollView
... >
<LinearLayout
...
android:orientation="vertical">
<TextView
android:id="@+id/textContact"
... />
<LinearLayout
...
android:orientation="vertical">
<ListView
android:id="@+id/listContact"
... />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
... />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
是否有任何设计问题,此处使用的窗口小部件/控件的任何兼容性问题,或其他任何问题?
我正在使用此jQuery脚本,该脚本根据 div 的宽度自动水平滚动div。但是我需要它根据div 内部内容的结尾滚动到div的末尾。div具有'overflow-y:scroll'属性,因此我希望它滚动所有内容,直到到达末尾。
这是我当前正在使用的脚本:
function animatethis(targetElement, speed) {
var width = $(targetElement).width();
$(targetElement).animate({ marginLeft: "-="+width},
{
duration: speed,
complete: function ()
{
targetElement.animate({ marginLeft: "+="+width },
{
duration: speed,
complete: function ()
{
animatethis(targetElement, speed);
}
});
}
});
};
animatethis($('#q1'), 5000);
Run Code Online (Sandbox Code Playgroud)
它会滚动,但不会滚动到div内容的末尾。这是一个显示我的意思的jFiddle:http : //jsfiddle.net/rKu6Y/535/
我如何才能将其水平自动滚动到内容的结尾,而不仅仅是div的宽度?
我希望这一切都有意义。谢谢。
我注意到当使用基于弹性框的布局与position: fixed页脚时,滚动功能是不同的.固定的页脚更平滑,并显示滚动条.Flexbox根本不光滑,并且不显示滚动条.我更喜欢使用flexbox进行布局,但想要更好的滚动.有没有办法用flexbox实现它?
我在IOS 10 Iphone 7上进行测试.发生在Chrome和safari上
HTML:
<html>
<head>
<meta name=viewport content="width=device-width,initial-scale=1">
</head>
<body>
<div id='main'>
...lots of content so it would scroll
</div>
<nav class="footer">footer</nav>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Flexbox方法:
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
-webkit-flex-direction: column;
flex-direction: column;
display: flex;
}
#main {
-webkit-flex: 1 1 auto;
overflow-y: auto;
min-height: 0px;
}
.footer {
height: 72px;
min-height: 72px;
background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)
固定页脚方法:
html, body {
height: 100%;
margin: 0; …Run Code Online (Sandbox Code Playgroud) 我有一个TDbGrid链接到一个数据集,在这个网格中显示行.
当在网格上滚动时,它会移动数据集的选定行,这意味着如果我想要进入网格的底部,它会浏览每个记录,并且只有当我位于网格的底部时才会显示网格后面的记录.网格,我除了的行为是:我希望屏幕移动但不是我选择的记录(因此更改行的唯一方法是单击该行).你知道怎么做吗?
我除外的行为与IDE delphi 10的'对象检查器'中的行为相同.
我正在使用以下JS代码来构建一个在悬停时滚动的水平图像轮播.该mousemove事件检测到鼠标移到容器并滚动到左边或相应的右的位置.一切都按照我的预期工作,但如果我在动画运行时将鼠标移到容器上,它会变得有点生涩.
这有什么解决方案吗?
谢谢
JS:
$( '.carousel-frame ul' ).mousemove( function(e) {
var container = $(this).parent();
if ((e.pageX - container.offset().left) < container.width() / 2) {
var direction = function() {
container.animate({scrollLeft: '-=600'}, 1000, 'linear', direction);
}
container.stop().animate({scrollLeft: '-=600'}, 1000, 'linear', direction);
} else {
var direction = function() {
container.animate({scrollLeft: '+=600'}, 1000, 'linear', direction);
}
container.stop().animate({scrollLeft: '+=600'}, 1000, 'linear', direction);
}
}).mouseleave( function() {
var container = $(this).parent();
container.stop();
});
Run Code Online (Sandbox Code Playgroud)
CSS:
.carousel-frame {
width: 100%;
margin-bottom: 0.5em;
padding-bottom: 1em;
position: …Run Code Online (Sandbox Code Playgroud) 我需要一个绝对定位的容器,该容器的大小应与内容的大小一样大(以便与容器后面的内容进行尽可能多的交互),但绝对不能超过最大高度(窗口的高度)。
内容具有三个子DIV,顶部两个是静态高度,如果滚动超过了父级的最大高度,则底部将使用滚动条占据剩余空间,该内容将被隐藏或显示。如果容器的高度为静态高度,则此方法效果很好,但是如果容器的高度仅为最大高度,则似乎孩子的calc无法正常工作,并且内容仅被裁剪。
编辑:需要支持IE 9+。
小提琴:https://jsfiddle.net/z87cnmr2/1/
#container {
position: absolute;
top: 0;
left: 0;
max-height: 100%;
/* uncomment this static height to see it work */
/* height: 100%; */
width: 100px;
overflow: hidden;
}
#tip {
background: #ff0;
height:20px;
}
#top {
background: #f00;
height:20px;
}
#btm {
background: #0f0;
max-height: calc(100% - 40px);
overflow-y: auto;
}
html, body {
padding: 0;
margin: 0;
height:100%;
width:100%;
}Run Code Online (Sandbox Code Playgroud)
<div id="container">
<div id="tip">Tips</div>
<div id="top">Tops</div>
<div id="btm">
Btm<br>
Btm<br> …Run Code Online (Sandbox Code Playgroud)我正在开发带有聊天的应用程序,我希望我ListView在用户发布新消息时滚动到底部,当用户位于列表底部并收到新消息时.我用这个ListView:
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"
android:stackFromBottom="true"
android:paddingBottom="9dp"
android:clipToPadding="false"/>
Run Code Online (Sandbox Code Playgroud)
并且此方法在需要时强制滚动:
private void scrollListViewToBottom() {
listView.setSelection(adapter.getCount() - 1);
}
Run Code Online (Sandbox Code Playgroud)
但是当聊天包含高度大于屏幕高度的元素(大文本或图像)时,它会滚动到它的顶部.我需要我ListView精确地滚动到底部,而不是最后一个元素.
我尝试使用listView.scrollTo(0, listView.getBottom())方法,但结果很奇怪 - 有时滚动到最后一条消息+半屏间隙,有时到我看不到任何消息的地方.
有任何想法吗?谢谢.
我有fragment一个nestedScrollView一些静态信息和一些LinearLayouts有知名度GONE。
这些LinearLayout在fragment打开后得到填充,然后在VISIBLE上设置这些布局的可见性。我只想在加载此信息时滚动到该片段的底部。
我试图与物业descendantFocusability并使用fullscroll function这个nestedScrollView,但我没有得到任何结果。