在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:yconst/Freetile开源软件地址:https://github.com/yconst/Freetile开源编程语言:JavaScript 92.5%开源软件介绍:FreetileFreetile is a plugin for jQuery that enables the organization of webpage content in an efficient, dynamic and responsive layout. It can be applied to a container element and it will attempt to arrange its children in a layout that makes optimal use of screen space, by "packing" them in a tight arrangement. Freetile has been the layout engine behind Assemblage and Assemblage Plus for almost two years, and now it becomes available as an independent Open Source project. FeaturesFreetile is inspired by similar, existing efforts such as Masonry, vGrid and Wookmark. However, it differs from these solutions in some aspects:
Additionally, Freetile has the following key features:
UsageDefault usage: $('#container').freetile(); Enable animation, with a per-element delay of 30ms: $('#container').freetile({ animate: true, elementDelay: 30 }); Specify a custom element selector: $('#container').freetile({ selector: 'customSelector' }); Specify a scoring function with a preference for left side placement: $('#container').freetile({ scoreFunction: function(o) { return -(o.TestedTop) * 8 - (o.TestedLeft); } }); Append some elements to an existing container: $('#container').freetile({ contentToAppend: 'someSelector'; }); OptionsVarious options may be passed along to Freetile when it is called: $('#container').freetile({ // options option1: 'value', option2: 'value', option3: 'value' // etc... }); Following is a short list of options and their description. selector Elements matching the selector will be tiled, others will be ignored. animate Should elements be animated? Animation will occur for elements that have been already placed and are visible, i.e. elements that are about to appear or are invisible will not be animated (but will still be tiled). Furthermore, elements with both their starting and ending position outside the window area will not be animated. Default: false elementDelay A delay may be inserted between each element's animation start, resulting in more appealing animations. Units in ms. Default: 0 containerResize Should the content be re-tiled on window resize? Default: true containerAnimate Should the container of the elements be animated, as its size changes? Useful if the placement of surrounding content depends on the container size. Default: false customEvents One or more custom events to trigger re-tiling. loadCheckSelector Freetile will make sure that images of elements matching this selector are loaded (using ImagesLoaded). Useful to exclude elements if inline dimension styles are being applied to e.g. images. Default: :not(.ignore-load-check) callback A callback function to be called when tiling is done. Please note that this includes the animation delay. persistentCallback Should the callback function be persistent or reset after next tiling (one-shot)? Useful for triggering common tasks at the end of the animation process. Default: false CSS3 GPU animationsUsing CSS3 csstransforms3d If set to true, it means that css3 3D transforms (on the GPU) are available and should be used for all animations over the slower Should be set to the value of a feature detect (e.g. using Modernizr) $('#container').freetile({ ... selector: '.grid-item', csstransforms3d: $('html').is('.csstransforms3d') }); Gotcha: CSS transforms do not effect document flow so your tile container height will no longer reflect the true height of your grid Make sure you are also using CSS3 transitions on each element in your grid to get it to animate: .grid-item{ webkit-transition: all .25s ease-out; -moz-transition: all .25s ease-out; -o-transition: all .25s ease-out; -ms-transition: all .25s ease-out; transition: all .25s ease-out; } DemoDemo at yconst.com LicenseFreetile is licensed under the BSD License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论