亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

創(chuàng)建一個Dribbble的作品展示

系統(tǒng) 2003 0

Most designers on dribbble have a personal portfolio website that usually consists of a name and a bit about themselves – maybe even some work.

When it comes to updating this?static?page you usually put it off in favour of the booming community of dribbble as it is thriving, less hassle and quick.

In this article I’ll explain how to create a dribbble powered portfolio that updates automatically using? jRibbble .

For this tutorial I created a simple HTML template as I didn’t want to make it more complex than it really is.

The main point to this tutorial is to enable you to incorporate your dribbble feed into your own design. I am not teaching how to design or develop a page.

Let’s Get Started

I’m assuming in this tutorial you have some decent HTML & CSS knowledge and havesome?understanding of JavaScript (jQuery).

Firstly we are going to start with a basic HTML5 markup and include our: stylesheet, jQuery and jRibbble.

    <!DOCTYPE html>

<html>

  <head>

    <title>Create a Dribbble Powered Portfolio by Ultralinx</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Page Style -->

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

    <!--[if IE]>

    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

    <![endif]-->

  </head>

  <body>



    <!-- jQuery  -->

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

    <!-- jRibbble -->

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

  </body>

</html>
  

You can download the barebones of this project? here ?(The project up to this step) and follow along.

We are then going to create a container which the feed will be displayed in and call it “dribbble-feed”. This will go inside the body.

    <section class="dribbble-feed">

      <!--Dribbble feed-->

</section>
  

This will be empty and no HTML will be written by us. jRibbble generates the HTML that will go into this container.

If we look at the page at the present it won’t display any content. This is because we have not asked jRibbble to fetch the content for us.

To do this we are going use the following javscript (jQuery) to tell jRibbble to get the shots and display the way we want.

You are in control of how it’s displayed. For this tutorial I am going to get the dribbble shots and link them to their page on dribbble.

Paste the below code outside the body but inside the html. So after “</body>” but before “</html>”.

    <script type="text/javascript">

$(document).ready(function getDribbbleShots() {   

  $.jribbble.getShotsByPlayerId('Ultralinx', function (playerShots) {

      var html = [];

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

          html.push('<div class="shot"><a href="' + shot.url + '" target="_blank">');

          html.push('<img class="shot-image" src="' + shot.image_url + '" ');

          html.push('alt="' + shot.title + '"></a></div>');

      });

      $('.dribbble-feed').html(html.join(''));

  }, {page: 1, per_page: 9});

});

</script>
  

What? How does that get the shots?

Well I will break it down line by line.

    $(document).ready(function () {
  

This calls jRibbble once the document (page) has loaded.

    $.jribbble.getShotsByPlayerId('UltraLinx', function (playerShots) {
  

This is asking jRibbble to get the the shots for ‘Ultralinx‘. You would replace this with your dribbble username or id.

    var html = [];
  

This creates an empty array of all the html we will generate below that will contain the shots.

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

This is a for each loop. Basically it means “For Each” shot on your dribbble profile produce the following code.

    html.push('<div><a href="' + shot.url + '" target="_blank">');

html.push('<img src="' + shot.image_url + '" ');

html.push('alt="' + shot.title + '"></a></div>');

});
  

Each tag: “+ shot.url +”, “+ shot.image_url +” and ” + shot.title +” has a line to itself. You are in control of any classes you set for CSS customisation.

This creates a div with the image inside that links to the dribbble page.

    $('.dribbble-feed').html(html.join(''));
  

This is joins all that information stored in the array to produce the HTML and puts it in the “dribbble-feed” container we made earlier.

     }, {page: 1, per_page: 9});

});
  

This is tells jRibbble how many shots to grab per page. This isn’t the pages on your dribbble profile. A page is define by what you choose “per_page”.

In the example I have chosen 9 shots per page which means page 2 will display shots 10-19 and so on.

If you view the page now it should display the shots. You can then use CSS to style them to suit your needs.

That’s it basically.?My next tutorial will explain how to display more information and enable pagination.

Quick Last Minute Tip

As there are 9 images being loaded at once some peoples internet may not be fast enough to instantly display them all and may experience a slight delay.

We can solve this by hiding the “dribbble-feed” until the images are loaded. Place this before the code previously written.

    $('.dribbble-feed').hide();

jQuery(window).load(function(){

$('.dribbble-feed').fadeIn();

});
  

This hides the container that will display the shots until it is fully loaded then fades it in.

You can even go that bit extra and add a loading bar then hide it when the feed is loaded.

I hope this is worthwhile to people who don’t have time to figure out the dribbble API and prefer to use jQuery in their projects.

Download Source ?|? Live Demo

創(chuàng)建一個Dribbble的作品展示


更多文章、技術交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产精品白丝喷水在线观看 | 午夜一级大片 | 伊人久久大杳蕉综合大象 | 亚洲曰本大成网站mmm | 成人毛片免费观看视频大全 | 亚洲国产欧美国产第一区二区三区 | 男女一级毛片免费播放 | 中文字幕日韩女同互慰视频 | 国产一区二区三区精品视频 | 日本一级网站 | 国产精品福利视频主播真会玩 | 久久天天躁夜夜躁狠狠 | 狠狠躁天天躁 | 久久久久精彩视频 | 亚洲国产精品人久久 | 夜夜夜爽 | 中文字幕在线永久 | 成人不卡在线 | 久久频精品99香蕉国产 | 免费看a毛片 | 国产亚洲精品一区二区久久 | 久久精品99成人中文字幕880 | 精品午夜寂寞影院在线观看 | 成人毛片在线观看 | 国产亚洲第一伦理第一区 | 2020国产成人免费视频 | 久久久久久国产精品mv | 日韩欧美中文字幕一区 | 一级毛片成人免费看a | 国产一级内谢a级高清毛片 国产一级片毛片 | 青青热在线观看视频精品 | 欧美金八天国 | 老师粗又长好猛好爽视频 | 亚洲一区精品视频在线 | 成人永久免费视频网站在线观看 | 国产日韩欧美亚洲综合在线 | 96精品国产高清在线看入口 | 久久亚洲国产视频 | 亚洲国产精品一区二区首页 | 久久精品免费视频观看 | 国产99在线|