V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  ccccccc  ›  全部回复第 4 页 / 共 6 页
回复总数  105
1  2  3  4  5  6  
2015-09-16 10:54:48 +08:00
回复了 kisnows 创建的主题 问与答 写了一个简单的 fullpage 框架,希望大家提提意见
@kisnows 就是轻轻滑动一下触摸板,然后页面会滚动几个页面
2015-09-16 09:47:12 +08:00
回复了 kisnows 创建的主题 问与答 写了一个简单的 fullpage 框架,希望大家提提意见
@kisnows 在 mac 上触摸板上多次滚动还是有问题, 下面代码是另一个 fullpage 插件的做法

// https://github.com/alvarotrigo/fullPage.js
// Gets the average of the last `number` elements of the given array.
function getAverage (elements, number ) {
var sum = 0;

//taking `number` elements from the end to make the average, if there are not enought, 1
var lastElements = elements.slice (Math.max (elements.length - number, 1 ));

for (var i = 0; i < lastElements.length; i++) {
sum = sum + lastElements[i]
}

return Math.ceil (sum/number );
}

var prevtime = new Date ().getTime ();
$(document ).on ('mousewheel wheel DOMMouseScroll', function (e ) {
e.preventDefault ()

var curtime = new Date ().getTime ();

var value = e.wheelDelta || -e.deltaY || -e.detail;
var delta = Math.max (-1, Math.min (1, value ));

//Limiting the array to 150 (lets not waste memory!)
if (scrollings.length > 149 ) {
scrollings.shift ()
}

//keeping record of the previous scrollings
scrollings.push (Math.abs (value ))

//time difference between the last scroll and the current one
var timeDiff = curtime-prevtime;
prevtime = curtime;

//haven't they scrolled in a while?
//(enough to be consider a different scrolling action to scroll another section )
if (timeDiff > 200 ) {
//emptying the array, we dont care about old scrollings for our averages
scrollings = [];
}

if (canScroll ) {
var averageEnd = getAverage (scrollings, 10 );
var averageMiddle = getAverage (scrollings, 70 );
var isAccelerating = averageEnd >= averageMiddle;

//to avoid double swipes...
if (isAccelerating ) {
//scrolling down?
if (delta < 0 ) {
hash ('down')

//scrolling up?
} else {
hash ('up')
}
}
}
})
2015-09-15 11:30:57 +08:00
回复了 kisnows 创建的主题 问与答 写了一个简单的 fullpage 框架,希望大家提提意见
在 mac 上 window.onscroll = function (e ) {console.log (e )}

然后轻轻滑动触摸板, console 输出下面

VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
VM127:2 Event {}
2015-09-15 10:37:52 +08:00
回复了 kisnows 创建的主题 问与答 写了一个简单的 fullpage 框架,希望大家提提意见
@kisnows 你现在这样的做法还是没办法阻止 mac 上多次滚动问题, 当你完成一个滚动动作时候, 事实上那个触摸板的滚动事件还在触发, 所以才有多次滚动问题.
2015-09-15 09:19:09 +08:00
回复了 kisnows 创建的主题 问与答 写了一个简单的 fullpage 框架,希望大家提提意见
@kisnows mac 触摸板会有一个 '缓冲' 的行为, 具体表现是很多次触发滚动. 这个不是简单加条件限制可以组织的, 你可以参考一下另一个 fullPage 插件的做法.
2015-09-07 15:17:09 +08:00
回复了 ccccccc 创建的主题 分享发现 现在手机耗电很大原因是这些 app 的做法
@roygcbp 手机电脑可以互访的话, 是可以的
2015-09-07 14:13:44 +08:00
回复了 ccccccc 创建的主题 分享发现 现在手机耗电很大原因是这些 app 的做法
@roygcbp 127.0.0.1 就是本机, 不关局域网什么的, 也不用拿手机 ip
2015-09-06 15:05:12 +08:00
回复了 ccccccc 创建的主题 分享发现 现在手机耗电很大原因是这些 app 的做法
@fo2w 在 iOS 上好像有两种方式, 一种是播放空音频, 我不确定还有没有效果, 还有一种是请求后台常驻权限, 貌似 iOS 7 以上就可以了


@chengxiao BAT 系还有各种其他的都会, 你要删很多 app 了, 还是弄个 '绿色守护' 之类的


@honeycomb 你这样只是不允许页面访问这些生成的端口, 但是这些 web 服务器还是运行着
2015-09-06 14:12:06 +08:00
回复了 ccccccc 创建的主题 分享发现 现在手机耗电很大原因是这些 app 的做法
@airyland 我意思是几乎所有 baidu 相关的都会这样, 包括搜索, 贴吧.. 当然也包括统计
2015-09-06 13:58:48 +08:00
回复了 ccccccc 创建的主题 分享发现 现在手机耗电很大原因是这些 app 的做法
@dorentus 关于 iOS, 据我所了解, 是请求播放一段空音频, 然后就可以常驻后台
2015-08-27 14:45:11 +08:00
回复了 hellorubyworld 创建的主题 酷工作 [豆瓣北京] 热招前端、测试开发、移动开发工程师
如果 douban 在广州这边我早想去了, 但是在北京我怕我过去没几天就挂了
2015-08-21 11:48:49 +08:00
回复了 alexapollo 创建的主题 程序员 月经贴:现在最好的 JS 前端框架组合是?
没有最好, 只有最合适, 一切看项目需求
2015-08-10 15:07:05 +08:00
回复了 hzlzh 创建的主题 酷工作 腾讯 2016 校园招聘正式启动
介绍页面是只针对移动端的, pc 端访问一点反应都没有, 只有一张图
还有社招嘛?
2015-08-04 17:42:09 +08:00
回复了 xiaobetty 创建的主题 推广 晒出你最蠢的一段代码,送 Cherry 鼠标垫
alias cd=rm -rf
2015-07-30 17:45:59 +08:00
回复了 Mark24 创建的主题 CSS CSS 如何实现图片在中间,然后文字环绕?
2015-06-30 11:48:10 +08:00
回复了 wtz 创建的主题 前端开发 node npm gulp 中有没有办法监听 task 执行成功或者失败的状态
试试

gulp.task('copyfonts',function(){
return gulp.src(staticConfig['fonts'] + '/')
.pipe(gulp.dest('./dist/fonts/'))
.on('error', function(e) {
console.log(e)
})
})
2015-06-26 11:08:33 +08:00
回复了 alsacegustav 创建的主题 问与答 响应式布局,如何在移动设备上让图片 100%宽度
img {
max-width: 100%;
display: block; /* 这个加上好一些 */
height: auto;
}
文字: 加左右 padding
@66beta
@zhjits
@ETiV
谢谢, 我去试试
2015-04-17 17:21:02 +08:00
回复了 tini19 创建的主题 macOS osx 时间长了也得重启
10.9.3 用了78天,没有重启过, 很正常
1  2  3  4  5  6  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   804 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 29ms · UTC 20:30 · PVG 04:30 · LAX 13:30 · JFK 16:30
Developed with CodeLauncher
♥ Do have faith in what you're doing.