- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我想改变网页的默认滚动速度、数量和惯性。我谷歌了很多,但徒劳无功
幸运的是,后来,这一天,我找到了a plugin这允许我们仅在特定的 div 标记内而不是在整个网页中更改滚动速度、数量、惯性。
这是一个基本代码
$(".I-WILL-APPLY-ONLY HERE").mCustomScrollbar({
set_width:false,
set_height:false,
horizontalScroll:false,
scrollInertia:550,
SCROLLINERTIA:"easeOutCirc",
mouseWheel:"auto",
autoDraggerLength:true,
scrollButtons:{
enable:false,
scrollType:"continuous",
SCROLLSPEED:20,
SCROLLAMOUNT:40
},
advanced:{
updateOnBrowserResize:true,
updateOnContentResize:false,
autoExpandHorizontalScroll:false,
autoScrollOnFocus:true
},
callbacks:{
onScrollStart:function(){},
onScroll:function(){},
onTotalScroll:function(){},
onTotalScrollBack:function(){},
onTotalScrollOffset:0,
whileScrolling:false,
whileScrollingInterval:30
}
});
<div id="I-WILL-APPLY-ONLY HERE" class="I-WILL-APPLY-ONLY HERE">
A basic height in pixels would be defined for this element and any content appearing here will have a different scrollspeed,inertia.Mentioning heignt of this div element is compulsary,else i wont show the output </div>
问题是我想要整个页面,而不仅仅是一个特定的 div 元素。任何帮助将不胜感激。请帮助我
提前致谢
最佳答案
你可以使用 jQuery 来做到这一点,看看我的 fiddle :http://jsfiddle.net/promatik/NFk2L/
您可以添加滚动事件的事件监听器,请注意您可能会阻止滚动的默认操作...if (event.preventDefault) event.preventDefault();
然后该事件的处理程序将使用 jQuery animate 执行滚动 ...
function handle(delta) {
var time = 1000;
var distance = 300;
$('html, body').stop().animate({
scrollTop: $(window).scrollTop() - (distance * delta)
}, time );
}
您可以设置时间、距离(您还可以添加缓动方法),请参阅 fiddle 中的完整示例
关于jquery - 如何更改网页的默认滚动速度、滚动量、滚动惯性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14426548/
我在我的 Web 应用程序中构建了一个垂直 slider ,并支持 Hammer.js 的鼠标和触摸拖动事件。在拖动结束时(当用户释放鼠标按钮或将手指离开屏幕时,也称为“dragend”事件),如果上
我知道 OrbitControls.js 有一个damping 功能,它增加了全景图的平滑拖动,也称为缓动。我想实现相同的功能但不使用这个库。原因是我需要减少使用的代码量并更严格地控制鼠标或点击事
我试图让我的小行星在按下按钮后继续移动。 void Ship::applyThrust() { _v.setX(_v.getX() - sin(2 * M_PI * (_angle / 360)
我想获得 k 均值成本(scikit kmeans 中的惯性)。只是提醒一下: 成本是每个点到最近簇的距离平方和。 我在 scikit('inertia') 的成本计算之间发现了一个奇怪的差异, 以及
我正在尝试为缩放图像拖动添加动量/惯性效果(如 this example 或就像 iOs 所做的那样),但我遇到了困难。 我已经为此苦苦挣扎了一段时间,并找到了一些有用的资源(例如 this one
使用 jquery ui draggable (http://jqueryui.com/demos/draggable/) 拖动元素时如何启用缓动或惯性?我想重新创建类似于 maps.google.c
我正在使用 C++ 为 macOS 构建 SDL2 应用程序。我需要一些“基本”滚动的应用程序(如网络浏览器)。我使用 SDL_MouseWheel 事件 实现了这一点,它为我提供了一个功能齐全的
设置:我有一个水平 ScrollView 和一个 UISwipeGestureRecognizer,它在我向下滑动时会触发切换到另一个 View 。 问题:如果我水平滚动并开始向下滑动(禁用垂直滚动)
我有一个使用 Laravel 8、惯性 js、Vue.js 和 webpack 的项目。 VueJs chrome 开发工具不适用于此项目。它一直显示为未检测到,我尝试重新启动它,删除并阅读开发工具。
好的,所以我正在尝试在 iOS 中使用轮子形状制作“命运之轮”类型的效果,我可以在其中捕获并旋转轮子。我现在可以随心所欲地拖动和旋转轮子,但是一旦松开我的手指,它就会停止不动。我需要对其施加一些动量或
我是一名优秀的程序员,十分优秀!