有没有任何Facebook分享插件? [英] Is there any Facebook share plugin?
本文介绍了有没有任何Facebook分享插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< script> function fbs_click(){u = location.href; t = document .title伪; window.open( 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(U)+' & T公司= '+ encodeURIComponent方法(T),' 共享者 '' 工具栏= 0,status = 0,width = 626,height = 436'); return false;}< / script>< a rel =nofollowhref =http://www.facebook.com/share.php? u = http://www.google.comonclick =return fbs_click()target =_ blank>分享到Facebook< / a>
,我从来没有看到一个官方插件产生了相同的效果。为什么?有没有?
解决方案
Facebook分享按钮现在已被拒绝使用,但您仍然可以使用 sharer.php
Javascript:
函数fbShare(url,title,descr,image,winWidth,winHeight){
var winTop =(screen.height / 2) - (winHeight / 2);
var winLeft =(screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&p [title] ='+ title +'& p [summary] ='+ descr +'& ; p [url] ='+ url +'& p [images] [0] ='+ image,'sharer','top ='+ winTop +',left ='+ winLeft +',toolbar =状态= 0,宽度= '+ winWidth +',高度='+ winHeight);
}
HTML:
< a href =javascript:fbShare('http://jsfiddle.net/stichoza/EYxTJ/','Fb Share','Facebook share popup','http://goo.gl/dS52U',520,350)> Share< / a>
I always used this :
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=http://www.google.com" onclick="return fbs_click()" target="_blank">Share on Facebook</a>
and I never see an "official plugin" that made the same "effect". Why? Is there?
解决方案
Facebook Share Button is now deprecated, but you can still use sharer.php
Javascript:
function fbShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width='+winWidth+',height='+winHeight);
}
HTML:
<a href="javascript:fbShare('http://jsfiddle.net/stichoza/EYxTJ/', 'Fb Share', 'Facebook share popup', 'http://goo.gl/dS52U', 520, 350)">Share</a>
- JS Gist: https://gist.github.com/Stichoza/4942775
- Live Demo: http://jsfiddle.net/stichoza/EYxTJ/
这篇关于有没有任何Facebook分享插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文