19 พฤษภาคม 2555, 05:03:18
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: Animated Share Buttons, CSS & jQuery  (อ่าน 1239 ครั้ง)
0 สมาชิก และ 2 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general เมื่อ: 16 มีนาคม 2553, 00:27:50

HTML
โค๊ด: [Select]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="demo.css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>

</head>

<body>

<div id="main">

 <div id="share">

     <div id="stage">
    
     <div class="btn digg"><div class="bcontent"><a class="DiggThisButton"></a><script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div></div>
     <div class="btn tweetmeme"><div class="bcontent"><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div>
     <div class="btn dzone"><div class="bcontent"><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div>
     <div class="btn reddit"><div class="bcontent"><script type="text/javascript" src="http://www.reddit.com/button.js?t=2"></script></div></div>
     <div class="btn facebook"><div class="bcontent"><a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div></div>
    
     </div>
    
     <div id="share-label">
     </div>
    
 </div>
 
</div>
    
</body>
</html>

jQuery
script.js
โค๊ด: [Select]
$(document).ready(function(){
/* This code is run on page load */

var deg=0;
var dif=-3;

/* Assigning the buttons to a variable for speed: */
var arr = $('.btn');

/* Storing the length of the array in a viriable: */
var len = arr.length;

/* Finding the centers of the animation container: */
var centerX = $('#stage').width()/2 - 40;
var centerY = $('#stage').height()/2 - 60;

/* Applying relative positioning to the buttons: */
arr.css('position','absolute');

/* The function inside the interva is run 25 times a second */
setInterval(function(){

/* This forms an area with no activity in the middle of the stage */
if(Math.abs(dif)<0.5) return false;

/* Increment the degrees: */
deg+=dif;

/* Loop through all the buttons: */
$.each(arr,function(i){

/* Calculate the sine and cosine */

var eSin = Math.sin(((360/len)*i+deg)*Math.PI/180);
var eCos = Math.cos(((360/len)*i+deg)*Math.PI/180);

/* Setting the css properties */
$(this).css({
top:centerY+25*eSin,
left:centerX+90*eCos,
opacity:0.8+eSin*0.2,
zIndex:Math.round(80+eSin*20)
});

})

},40);

/* Detecting the movements on the mouse and speeding up or reversing the rotation accordingly: */

var over=false;
$("#stage").mousemove(function(e){

if(!this.leftOffset)
{
/* This if section is only run the first time the function is executed. */
this.leftOffset = $(this).offset().left;
this.width = $(this).width();
}

/* If the mouse is over a button, set dif to 0, which stops the animation */
if(over) dif=0;
else
dif = -5+(10*((e.pageX-this.leftOffset)/this.width));

/* In the other case calculate the speed according to the X position of the mouse */
});


/* Detecting whether the mouse is positioned above a share button: */
$(".bcontent").hover(
function(){over=true;dif=0;},
function(){over=false;}
);
});

CSS
โค๊ด: [Select]
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{
/* Simple page reset */
margin:0px;
padding:0px;
}

body{
/* Setting default text color, background and a font stack */
color:#eeeeee;
font-size:13px;
background: #1b232a;
font-family:Arial, Helvetica, sans-serif;
}

/* The code for the share box starts here: */

#share{
/* The share box container */
width:500px;
background:#ececec;
height:220px;
margin:60px auto;
overflow:hidden;

-moz-border-radius:12px;
-webkit-border-radius:12px;
border-radius:12px;
}

#share-label{
/* The image on the right */
background:url(img/share.png) no-repeat 50% 50%;
float:left;
height:220px;
width:200px;
}

#stage{
/* This is where the animation takes place */
position:relative;

border-right:1px solid #DDDDDD;
width:290px;
height:220px;
background:white;
float:left;

border-bottom-left-radius:12px;
border-top-left-radius:12px;

-moz-border-radius-bottomleft:12px;
-moz-border-radius-topleft:12px;

-webkit-border-bottom-left-radius:12px;
-webkit-border-top-left-radius:12px;
}

.btn{
/* This class is assigned to every share button */
background-color:white;
height:90px;
left:0;
top:0;
width:60px;
position:relative;
margin:20px 0 0 10px;
float:left;
}

.bcontent{
/* Positioned inside the .btn container */
position:absolute;
top:auto;
bottom:20px;
left:0;
}

/* Individual rules for every share button */

.digg{ background:url(img/digg_reflection.png) no-repeat -4px bottom;}
.reddit{ background:url(img/reddit_reflection.png) no-repeat -4px bottom;}
.facebook{ background:url(img/facebook_reflection.png) no-repeat bottom center;}
.tweetmeme{ background:url(img/twit_reflection.png) no-repeat -5px bottom;}
.dzone{ background:url(img/dzone_reflection.png) no-repeat -7px bottom;}

.thanksto{
position:absolute;
bottom:2px;
right:110px;
font-size:10px;
}

.thanksto a,.thanksto a:visited{
color:#BBB;
}

/* Customizing the facebook share button */

span.fb_share_no_count {
display:block;
}

span.fb_share_count_top.fb_share_no_count {
line-height:54px;
}

span.fb_share_count_nub_top.fb_share_no_count{
display:none;
}

span.fb_share_no_count span.fb_share_count_inner {
background:#3B5998 url(http://static.fbshare.me/f_only.png) no-repeat scroll 20px 5px;
display:block;
}

/* The styles below are only necessary for the demo page */

h1{
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
font-size:36px;
font-weight:normal;
margin-bottom:15px;
}

h2{
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
font-size:12px;
font-weight:normal;
padding-right:140px;
right:0;
text-align:right;
text-transform:uppercase;
top:15px;
}

.clear{
clear:both;
}

#main{
/* The main container */
margin:15px auto;
text-align:center;
width:600px;
position:relative;
}


a, a:visited {
color:#0196e3;
text-decoration:none;
outline:none;
}

a:hover{
text-decoration:underline;
}

p{
/* The tut info on the bottom of the page */
padding:10px;
text-align:center;
}

IMAGES


ลิงค์หัวข้อ: http://dexmore.com/topic/1069
Windows XP    Firefox 3.6   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*



Thailand   ชาย ออฟไลน์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 20 พฤศจิกายน 2553, 10:05:21
ขอไฟล์สำเร็จรุปได้ไหมครับ เพราะผมเอาไปทำแล้วผมไม่เข้าใจว่ามันต้องทำกี่ไฟล์ 

เฟกี่ไฟลือะครับ อยากได้ไฟล์ที่ทำเสร็จแล้ว ช่วยทีนะครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/1069
Windows NT 6.1    Chrome 7.0.517.44   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 14 พฤษภาคม 2555, 02:31:20

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla