创建一个Dribbble的作品展示

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

时间: 2024-10-29 19:08:48

创建一个Dribbble的作品展示的相关文章

找专业团队或第三方公司做一个艺术家作品展示和交流平台网站

具体要求: 网站用途:类似于博客,艺术家个人的页面(可上传艺术作品).通过一些好的艺术作品吸引艺术爱好者加入上传艺术作品或粉丝关注来交流和讨论.专注于艺术这一块的作品展示和交流.开发语言:php(WordPress或其它更好的)参考网站:www.artgogo.com具体要求:1.网页设计及制作:首页设计(比如:最多推荐.编辑推荐.作品排名.显示最新作品,还有主菜单就是附件中的栏目介绍).呈现方式设计,方便图片展示.2.功能模块:前台功能:艺术家介绍及作品呈现(图片或Flash或视频等多种呈现方

【Bootstrap】2.作品展示站点

假设我们已经想好了要给自己的作品弄一个在线站点.一如既往,时间紧迫.我们需要快一点,但作品展示效果又必须专业.当然,站点还得是响应式的,能够在各种设备上正常浏览,因为这是我们向目标客户推销时的卖点.这个项目可以利用Bootstrap的很多内置特性,同时也将根据需要对Bootstrap进行一些定制. 1.设计目标 虽然对大屏幕中的展示效果已经胸有成竹,但我们还应该从小设备开始,强迫自己聚焦在关键的要素上面. 这个作品展示站点应该具有下列功能: □ 带Logo的可折叠的响应式导航条: □ 重点展示四

Bootstrap快速上手 --作品展示站点

本次我们将采用Bootstrap来快速构建一个响应式的,支持多种设备的在线站点. 一.设计目标 站点具备功能: 1.带有Logo的可折叠的响应式导航条: 2.重点展示四张作品的图片传送带: 3.单栏布局中包含三块内容,每块内容都包含标题.短段落和吸引人点击阅读的大按钮: 4.页脚包含社交媒体链接 基本HTML样式  1 <!DOCTYPE html> <!-- html5标签 --> 2 3 <!--[if lt IE 7]> <html class="

搭建QQ聊天通信的程序:(1)基于 networkcomms.net 创建一个WPF聊天客户端服务器应用程序 (1)

搭建QQ聊天通信的程序:(1)基于 networkcomms.net 创建一个WPF聊天客户端服务器应用程序 原文地址(英文):http://www.networkcomms.net/creating-a-wpf-chat-client-server-application/ 注意:本教程是相当广泛的,如果你是在短请也看到我们的东西 开始和 如何在几分钟内创建一个客户端服务器应用程序教程. 注2:本例中包括,明显延长进一步证明功能,在包中包含的示例 包下载. 在我们开始之前确保您已经安装了Vis

分析Linux内核创建一个新进程的过程【转】

转自:http://www.cnblogs.com/MarkWoo/p/4420588.html 前言说明 本篇为网易云课堂Linux内核分析课程的第六周作业,本次作业我们将具体来分析fork系统调用,来分析Linux内核创建新进程的过程 关键词:fork, 系统调用,进程 *运行环境:** Ubuntu 14.04 LTS x64 gcc 4.9.2 gdb 7.8 vim 7.4 with vundle 分析 分析方法说明 PCB包含了一个进程的重要运行信息,所以我们将围绕在创建一个新进程时

iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序

iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序 一.plist文件和项目结构图 说明:这是一个嵌套模型的示例 二.代码示例: YYcarsgroup.h文件代码: // // YYcarsgroup.h // 07-汽车展示(高级) // // Created by apple on 14-5-28. // Copyright (c) 2014年 itcase. All rights reserved. // #import <Foundation/Foundation.h> @

第六周分析Linux内核创建一个新进程的过程

潘恒 原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 task_struct结构: struct task_struct {   volatile long state;进程状态  void *stack; 堆栈  pid_t pid; 进程标识符  unsigned int rt_priority;实时优先级  unsigned int policy;调度策略  struct files

分析Linux内核创建一个新进程的过程

一.原理分析 1.进程的描述 进程控制块PCB——task_struct,为了管理进程,内核必须对每个进程进行清晰的描述,进程描述符提供了内核所需了解的进程信息. struct task_struct{ volatile long state; //进程状态,-1表示不可执行,0表示可执行,大于1表示停止 void *stack; //内核堆栈 atomic_t usage; unsigned int flags; //进程标识符 unsigned int ptrace; …… } 2.进程的创

Android学习路线(二十一)运用Fragment构建动态UI——创建一个Fragment

你可以把fragment看成是activity的模块化部分,它拥有自己的生命周期,接受它自己的输入事件,你可以在activity运行时添加或者删除它(有点像是一个"子activity",你可以在不同的activity中重用它).本课将向你展示如何使用Support Libaray继承 Fragment 类来让你的应用能够兼容正在运行Android 1.6的设备. 提示: 如果你决定你的应用需求的最低API级别是11或者更高,那么你不需要使用Support Library,你可以直接使用