惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
S
Schneier on Security
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
Security Latest
Security Latest
Jina AI
Jina AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Recorded Future
Recorded Future
T
Tor Project blog
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
Forbes - Security
Forbes - Security
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
IT之家
IT之家
T
Threatpost
Cyberwarzone
Cyberwarzone
O
OpenAI News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
J
Java Code Geeks
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 薛端阳

12小时包你学会基于ReactMix框架的ReactNativeApp开发(二)基于Css+HTML写第一个app页面 12小时包你学会基于ReactMix框架的ReactNativeApp开发(一)Hello World! ReactMix框架,让你实现一套js代码,基于ReactNative在H5,App都能完美跑起来,Write Once,Run Anywhere [分享黑科技]纯js突破localstorage存储上线,远程抓取图片,并转码base64保存本地,最终实现整个网站所有静态资源离线到用户手机效果却不依赖浏览器的缓存机制,单页应用最新黑科技 不要听吹牛逼什么前端MVVM框架就是好,其实都是一帮没学好分层设计的搞出来的,让你彻底看清前端MVVM的本质 基于Css反射形自触发事件,优化你的延时事件 巧用正则零宽断言实现靓号检索逻辑 HTML5触屏版多线程渲染模板技术分享 (造福中国前端界)纯前端Js完美解决各种汉字urlencode,urldecode,编码解码问题,不借助任何字库,内码表,轻松一行,兼容IE8+,chrome,firefox,safari等主流浏览器 分享Css3设计---纯Css实现超酷的iphone玻璃气泡效果 中文前端UI框架Kit(十三)使用RequireJs托管你的类库和js代码 中文前端UI框架Kit(十二)整合Mustache做kitjs模板引擎,基本写法${varname} 中文前端UI框架Kit(十一)摇头动画?让你的页面元素嗑药嗑起来?? 中文前端UI框架Kit(十)Javascript多线程工作模型的实现 中文前端UI框架Kit(九)IE下实现W3C标准的range对象所有api,支持通过xpath跨浏览器实现特定选区高亮,书签标记功能 中文前端UI框架Kit(八)无插件异步文件上传组件源码解析 中文前端UI框架Kit(七)无插件异步文件上传组件,带进度,支持文件拖拽 中文前端UI框架Kit(六)javascript动画代码实现原理和一些小技巧 不知道大家知道不知道,iOS开发,web页面的链接的active属性无效,但是今天发现一个hack办法可以让Css的active有效
中文前端UI框架Kit(十四)超酷的瀑布流特效动画
薛端阳 · 2012-06-15 · via 博客园 - 薛端阳

Demo地址:http://xueduany.github.com/KitJs/KitJs/index.html#waterfall

image

(一)KitJs瀑布流组件特点

1. 瀑布流形式呈现图片加载,鼠标滚动到底加载新的数据

2. 瀑布条数随窗口大小改变而改变,支持任意缩放窗口

(二)使用方法

core需要引用kit.js,IE下通过条件注释引入ieFix.js

其他需要引入

array.js 数组扩展(可以不引用)

anim.js 动画扩展

即可,

至于demo中的semitransparentloading.js是用来做半透明loading的,io.js是用来跨域取图片数据的,这个load方法可以自定义

最简单的加载方式,比如

var currentPage = 1;
    var waterfall = new $kit.ui.Waterfall({
        container : $kit.el('.kitjs-waterfall-container')[0],
        load : function(success, end) {
            //$('#loadingPins').show();
            $kit.io.josnp({
                url : 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=5d93c2e473e39e9307e86d4a01381266&tags=rose&page=' + currentPage + '&per_page=20&format=json&_ksTS=1339665079110_92&jsoncallback=dealWithJSONPData',
                onSuccess : function() {
                    currentPage = window.loadedData.photos.page + 1;
                    //alert(window.loadedData.photos.photo.length);
                    var items = [];
                    $kit.each(window.loadedData.photos.photo, function(item) {
                        item.height = Math.round(Math.random() * (300 - 180) + 180);
                        // fake height
                        items.push($kit.newHTML($kit.tpl(['<div class="kitjs-waterfall" data-id="${id}">', //
                        '<a href="http://farm/${farm}.static.flickr.com/${server}/${id}_${secret}_m.jpg" class="image" target="_blank">', //
                        '<img height="${height}" alt="${title}" src="http://farm/${farm}.static.flickr.com/${server}/${id}_${secret}_m.jpg"/>', //
                        '</a>', //
                        '<p class="description">${title}</p>', //
                        '</div>'//
                        ].join(''), item)).childNodes[0]);
                    });
                    success(items);
                    window.timeoutLoading = setTimeout(function() {
                        if(window.loading) {
                            window.loading.destory();
                            window.loading = null;
                        }
                    }, 600)
                }
            })
        },
        minColCount : 2,
        colWidth : 228
      });
    waterfall.ev({
        ev : 'loadData',
        fn : function() {
            if(window.timeoutLoading) {
                clearTimeout(window.timeoutLoading);
                window.timeoutLoading = null;
            }
            if(window.loading == null) {
                window.loading = new $kit.ui.SemitransparentLoading();
            }
        }
    });
    waterfall.ev({
        ev : 'resizeBegin',
        fn : function() {
            if(window.timeoutLoading) {
                clearTimeout(window.timeoutLoading);
                window.timeoutLoading = null;
            }
            if(window.loading == null) {
                window.loading = new $kit.ui.SemitransparentLoading();
            }
        }
    });
    waterfall.ev({
        ev : 'resizeEnd',
        fn : function() {
            window.timeoutLoading = setTimeout(function() {
                if(window.loading) {
                    window.loading.destory();
                    window.loading = null;
                }
            }, 600)
        }
    });

指定一个容器,一个加载数据的方法,最小瀑布列数,瀑布宽度(这个是固定的)

在加载方法里面,初始化单个图片容器的Dom节点,需要显示指明节点高度,将height,domNode放入一个数组中,调用load方法的回调参数succes

(三)自定义事件

目前支持三个自定义事件,load触发之前会有一个load事件,还有缩放窗口的时候,有resizeBegin和resizeEnd事件,可以用来做loading动画

经过几个月的努力,现在kit已经有了完整的底层以及基础UI控件体系,包括

1. 完整的dom api

2. 强化的anim动画类,支持所有的Css动画,包括Css3以及IE Hacker

3. 平衡了IE与W3C的range对象了,完美兼容了W3C的所有的api,实现了跨浏览器的bookmark同步

4. 完整的OO体系,属性getter,setter,对象继承,单例,模块

5. 强大的模板系统,支持循环,if else条件判断

6. 齐全的浏览器侦测,手持设备,PC等等

7. 基础的UI体系,可以支持复杂的页面组件

包括不限于,蒙版,浮动层,对话框,拖拽,高级自定义增强事件,增强动画,日历,表单,验证,瀑布流...

8. 基础的log,安全沙箱,打包工具,自动化脚本等等

欢迎各位对kit有兴趣的朋友加入我们的开源项目,一起建设

号外:kitjs官方讨论QQ群建立了,QQ群号88093625,欢迎大家加入,讨论前端相关话题

另外,我们的产品,Mac版本大名鼎鼎的欧陆词典,招C#开发一名,有兴趣的可以看 http://www.eudic.net/company/joinus_eu.aspx