本文实例讲述了javascript实现类似百度分享功能的方法。分享给大家供大家参考。具体如下:
像腾讯,开心社区都提供这种分享接口的,做百度分享功能很简单的
一般网站要接入分享功能,大部分都用百度分享和addthis的代码,可是自己定制性太差,该分享功能样式都可以自己修改,简洁没过多js代码,大大提高网页加载速度。
运行效果如下图所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>网络分享代码分享</title> <style type="text/css"> /** * 分享代码样式 * by kily */ #ak_share { padding:10px 0; font-size:12px; } .ak_share { height:1%; overflow:hidden; } .ak_share dt { float:left; font-weight:bold; color:#A5A5A5; height:16px; line-height:16px; } .ak_share dd { margin-right:10px; margin-left:0; height:16px; float:left; } .ak_share a:hover { color:#ed7811; text-decoration:underline;} .ak_share a { float:left; height:16px; line-height:16px; padding-left:18px; background:url(http://www.yem120.com/images/share.gif) left top no-repeat; color:#666; text-decoration:none; } .ak_share .t_163_s { background-position: 0 -16px; } .ak_share .t_qq_s { background-position: 0 -32px; } .ak_share .qzone_s { background-position: 0 -48px; } .ak_share .douban_s { background-position: 0 -64px; } </style> </head> <body> <div id="ak_share"> <dl class="ak_share"> <dt>分享:</dt> <dd> <a class="t_sina_s" href="javascript:(function(){window.open('http://v.t.sina.com.cn/share/share.php" title="分享到新浪微博" rel="nofollow">新浪微博</a> </dd> <dd> <a class="t_163_s" href="javascript:(function(){window.open('http://t.163.com/article/user /checkLogin.do" title="分享到网易微博" rel="nofollow">网易微博</a> </dd> <dd> <a class="t_qq_s" href="javascript:(function(){window.open('http://v.t.qq.com/share/share.php" title="分享到腾讯微博" rel="nofollow">腾讯微博</a> </dd> <dd> <a class="qzone_s" href="javascript:void(window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey" title="分享到QQ空间" rel="nofollow">QQ空间</a> </dd> <dd> <a class="douban_s" href="javascript:void(function(){var%20d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,s=s1" title="推荐到豆瓣" rel="nofollow">豆瓣</a> </dd> </dl> </div> </body> </html>
希望本文所述对大家的javascript程序设计有所帮助。
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年10月04日
2024年10月04日
- 群星《前途海量 电影原声专辑》[FLAC/分轨][227.78MB]
- 张信哲.1992-知道新曲与精丫巨石】【WAV+CUE】
- 王翠玲.1995-ANGEL【新艺宝】【WAV+CUE】
- 景冈山.1996-我的眼里只有你【大地唱片】【WAV+CUE】
- 群星《八戒 电影原声带》[320K/MP3][188.97MB]
- 群星《我的阿勒泰 影视原声带》[320K/MP3][139.47MB]
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[320K/MP3][148.91MB]
- 刘雅丽.2001-丽花皇后·EMI精选王【EMI百代】【FLAC分轨】
- 齐秦.1994-黄金十年1981-1990CHINA.TOUR.LIVE精丫上华】【WAV+CUE】
- 群星.2008-本色·百代音乐人创作专辑【EMI百代】【WAV+CUE】
- 群星.2001-同步过冬AVCD【环球】【WAV+CUE】
- 群星.2020-同步过冬2020冀待晴空【环球】【WAV+CUE】
- 沈雁.1986-四季(2012梦田复刻版)【白云唱片】【WAV+CUE】
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[FLAC/分轨][257.88MB]
- 《国语老歌 怀旧篇 3CD》[WAV/分轨][1.6GB]