用Flexboxgrid和Jribbble创建Dribbble的展示网格

使用网格构建已经成为前端开发人员的日常需求。网格不仅在设计中提供了节奏感和一致性,而且当使用众所周知的网格结构时,它为跨团队工作提供了一种简单的集体设计语言。

 

FLUBBOXGRID是一个新的框架,它允许您将网格系统的可预测性和通用语言结构与FrasBox的灵活性和简单性相结合。今天,我们将通过使用FaskBox网格的基本知识,并使用它来构建一个简单的DRBOBLY饲料组合页面。让我们开始吧!

开始使用FraceBox网格CSS

开始Flexboxgrid的第一步是抓住CSS。为了发展,使用未缩小的版本。

接下来,让我们来谈谈Flexboxgrid搭建买国画网页面时是如何工作的。文档完全包含在FrimbxGrID.com的主页上,但我们将浏览高点。

响应式列

FLUBBOXGRID是为了支持四个主断点而建立的,可以任意命名以避免像素特定的断点维护问题。这些断点是手、膝、书桌和墙壁,命名为手、膝、桌和墙视口宽度(即:设备可能发现自身)。列类本身是这样构造的:

1

2

3

column-[number]--[breakpoint]

column-4--hand

column-auto--wall

FLUBBOXGRID是一个十二列网格,并使用百分比为基础的列结合功率Frasbox的岩石固体网格。

 

注意:FraceBox的浏览器支持仍然不完整;Flexboxgrid不应该依赖于需要完全跨浏览器实现的项目。

 

示例行

 

直接从文档中看到,使用FraceBox网格的示例行的标记看起来像这样:

<div class="row">

    <div class="column-12--hand

                column-8--lap

                column-6--desk

                column-4--wall">

        <div class="box">Responsive</div>

    </div>

</div>

自动列

 

在每个断点处都有一个“自动”列宽度。这与传统的宽度不同:自动规则。FrasBox将自动填充行,即使大小有多少列,不管行中是否有多少列。

<div class="row">

    <div class="column-auto--hand">

        <div class="box">auto</div>

    </div>

    <div class="column-auto--hand">

        <div class="box">auto</div>

    </div>

    <div class="column-auto--hand">

        <div class="box">auto</div>

    </div>

</div>

对准

 

可以使用FraceBox网格进行更多的操作,包括水平地排列行的列:

<div class="row start"></div>

 

<div class="row center"></div>

 

<div class="row end"></div>

以及垂直排列的:

1

2

3

4

5

<div class="row top"></div>

 

<div class="row middle"></div>

 

<div class="row bottom"></div>

FLUBBOXGRID还利用FrasBox的简单重新排序技术和动态间距选项,但现在我们将向前迈进,创造我们的运输机网格!

 

 

 

盘旋的格子

 

我们将从一个简单的空HTML文档开始,包括jQuery和规范化。随意使用HTML5样板工具,比如AcimiZr工具,但是对于这个项目,我们将继续关注你需要自己编写的JavaScript、HTML和CSS。

<!doctype html>

<html>

<head>

    <link rel="stylesheet" href="css/normalize.css">

    <link rel="stylesheet" href="css/flexboxgrid.css">

    <link rel="stylesheet" href="css/style.css">

</head>

<body>

    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script src="js/script.js"></script>

</body>

</html>

从这里,我们将构建我们想要使用的HTML的结构,然后我们将用可移动的API来勾结所有的东西。

 

我们的网格标记

 

首先,假设我们想要建立一个网格,它每水平行至少有两个块,在墙壁断点处每行移动多达六个块。以下是我们如何做到这一点:

 

  <div class="row">

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

    <div class="column-6--hand column-4--lap column-3--desk column-2--wall"></div>

</div>

column-6--hand指定在手断点(对于手持的设备),每个块将填充十二列中的六个。因此,我们将能够在这一点上在我们的布局的一排上安装两个可拖动的缩略图。

 

在搭接断点处,柱状-4圈规定每一块将是四列宽,因此我们将能够适应三行一行。

 

动态标记

假设我们想要使网格更加动态化。下面是一个使用自动宽度和可变宽度的网格行的例子。

<div class="row">

    <div class="column-6--hand column-3--lap column-2--desk column-auto--wall"></div>

    <div class="column-6--hand column-3--lap column-4--desk column-auto--wall"></div>

    <div class="column-6--hand column-3--lap column-3--desk column-auto--wall"></div>

    <div class="column-6--hand column-3--lap column-3--desk column-auto--wall"></div>

    <div class="column-6--hand column-6--lap column-5--desk column-auto--wall"></div>

    <div class="column-6--hand column-6--lap column-7--desk column-12--wall"></div>

</div>

注意:在墙壁断点中,我们实际上有一个五的网格,在没有自定义类的情况下,十二列网格系统通常是不可能的,因为十二不能被五整除。然而,利用FRACKBOX,可以很容易地自动计算列宽度。

 

 

Jribbble

 

现在我们有了网格结构,让我们编写必要的代码来引入我们的内容。我们将使用jQuery插件jLable。您可以从GITHUB获取源代码。JRANBLE将使它非常容易从运球中投篮。

 

在一个单独的JS文件中,或者在Script .js的顶部包含jLable。在下面的代码中,这个代码会带来你想要的投篮。

(function(){

    var playerId = "envato";

    $.jribbble.getShotsByPlayerId(playerId, function(data){

        var shots = data.shots;

        var h = '';

        $(shots).each(function(i, shot){

            h += '<div class="column-6--hand column-4--lap column-3--desk column-2--wall">';

            h += '<a href="' + shot.url + '"><img src="' + shot.image_teaser_url + '"></a>';

            h += '</div>';

        });

        $('.dribbble-shots').html(h);

    });

}());

 

我们首先将代码封装在一个立即调用的函数表达式中,这确保了我们保护JavaScript范围。接下来,我们设置我们的球员ID,然后我们使用jPLANLLE来投篮。一旦我们有了自己的镜头,我们就可以通过遍历每一个镜头来创建HTML,并用HTML来填充一个元素。

 

我们的HTML结构应该是这样的:

<!doctype html>

<html>

<head>

    <link href='http://fonts.googleapis.com/css?family=Maven+Pro' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="css/normalize.css">

    <link rel="stylesheet" href="css/flexboxgrid.css">

    <link rel="stylesheet" href="css/style.css">

</head>

<body>

 

    <div class="container">

        <h1>My Dribbble Shots</h1>

        <div class="row center dribbble-shots">

        </div>

    </div>

 

    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script src="js/script.js"></script>

</body>

</html>

注意我们已经包含了GOOGLE字体。

最小样式

下一步 ,我们将提供一些最小的样式在文件 style.css:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

body {

    font-family: 'Maven Pro', sans-serif;

    background-color: #f1faff;

}

h1 {

    font-weight: 400;

}

*[class^=column] {

    /*max-height: 100px;*/

    overflow: hidden;

    margin-bottom: 12px;

}

*[class^=column] img {

    width: 100%;

}

 

.container {

    width: 80%;

    margin: 0 auto;

    position: relative;

    padding-top: 100px;

}

 

a {

    display: block;

    opacity: 0.9;

}

 

a:hover {

    opacity: 1;

}

您的最后的作品如下图:

网站模板下载结论:

FLUBBOXGrid提供了一种非常灵活的网格解决方案,它允许对间隔、大小、显示甚至元素的顺序进行一些非常有趣的控制。当结合引人注目的内容时,Flexboxgrid允许您轻松地使用网格之前复杂得多的内容。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值