How to make custom share buttons - facebook

I have always wanted to add Facebook share buttons to my applications, but the problem that I have is that they all look different. I see sites like this that have custom designed share buttons. Does anybody know a good tutorial, or have any pointers, about how to tackle this?

Sharing something one facebook is quite easy, here is the HTML for my custom share button.
<div id="share_div">
<div id="share">
<a class="click" href="http://www.facebook.com/dialog/feed?app_id={{fbapp_id}}&link={{link_url}}&message={{share_message|urlencode}}&display=popup&redirect_uri={{link_url}}" target="_blank">
Share
</a>
</div>
</div>
Where all the {{variables}} are to be replace by correct value :
fbapp_id is the id of your facebook application.
link_url is a link attached to the shared content (like a link to your site)
and share_message|urlencode is the message that is shared and it needs to be urlencoded.
Also here some css to style this like a real facebook button :
#share {
border:1px solid #0D386F;
background-color:#5D7DAE;
height:24px;
width: 100px;
}
#share a.click {
font-size:13px;
font-weight:bold;
text-align:center;
color:#fff;
border-top:1px solid #879DC2;
background-color:#5D7DAE;
padding: 2px 10px;
cursor: pointer;
text-decoration:none;
width:80px;
display:block;
}
But I let you the pleasure of customizing as you like, the important part being the href of the a tag
Does it answer your question ?

Related

Is there a way to dynamically add a "last" class to the last post appearing in a Tumblr tag page?

I was wondering whether it is possible to add a "last" class to the last post appearing in a tumblr tag page in order to be able to customize it in css?
The goal is the following: let us say that a certain tag has 3 posts, so when I navigate in that tag page, the 3 posts appear, one below the other. I would like the first two separated by a line located at the bottom of each post body, but the last one on the bottom of the page should not have a separation line at its bottom, so I guess I would need a specific class for that post since it is the last one.
Thank you.
As per my comment you can achieve this by simply using a css selector :last-of-type or :nth-child(last)
Here is an example.
HTML:
<div id="posts">
<div class="post">
Post 1
</div>
<div class="post">
Post 2
</div>
<div class="post">
Post 3
</div>
</div>
CSS:
#posts .post {
margin-bottom: 20px;
border-bottom: 2px solid #444;
}
#posts .post:last-of-type {
background-color: orange;
border-bottom: none;
}
There is a jsfiddle here: https://jsfiddle.net/lharby/39ap851L/
So each post item will have a border bottom, but for the last post of type we override this with border-bottom: none

How to design a "two column button" in Ionic framework

What I would like to achieve is this:
Surely, I went through the button documentation, but it seems nothing similar is there. So, I would appreciate some pointing in the right direction (codepen with a basic example would be most awesome).
So, ideally, this would be one button tag where I would be able to pass two variables (one which would appear on the left and one on the right). This does smell like a job for a Angular directive, though I haven't fiddled with it too much just yet so a friendly nudge in the right direction would be appreciated.
There is something similar to this in their documentation
http://ionicframework.com/docs/components/#button-bar
<div class="button-bar">
<a class="button">First</a>
<a class="button">Second</a>
</div>
What I ended up doing in the end was this: I created a div with a class button and then inside it I created additional two div's with custom classes.
The code below:
.leftButtonSide {
width: 50%;
float: left;
color: #000;
}
.rightButtonSide {
width: 50%;
float: left;
background: #F2F2F2;
color: #000;
border-radius: 2px;
}
<div ng-repeat="d in data" class="button button-positive-outline">
<div class="leftButtonSide">2</div>
<div class="rightButtonSide">2,00</div>
</div>
True, for the exact same look you would have to play a bit with CSS. I ended up with this in the end:
Hope this helps someone too!

Missing Title on Facebook Plugin - Joomla 1.5

I'm working on a blog page for a site that's currently running on Joomla 1.5 (slowly rolling out upgraded templates but I need this one to work in the meantime).
I'm using the Facebook like box and have the Facebook header set to 'false' I've got the module title set to show, but it's not appearing on the page. The Facebook code is set in a custom module and I have several other custom modules on the page with functional titles.
I've got the same set up on a separate blog page in Joomla 3 that is working without issues. Is this just a lack of compatibility with Joomla 1.5?
Here's the page for your review http://discoverestevan.com/index.php?option=com_content&view=category&layout=blog&id=22&Itemid=455
Not the most elegant solution, but I ended up using an ID within the module that applied to the 'header' space of the Facebook widget. Note that I could not leave it the default ID name or it applied the title styles to a checker div at the top of the page with the same ID name.
I used :before to write the title text in via CSS. The final CSS code looks like this:
#fb-head {
background: rgb(212, 31, 60); /*Logo Colour: #b31c27*/
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
padding: 10px;
margin-right: -2px;
}
#fb-head:before {
content: "Find Us on Facebook";
color: white;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 18px;
line-height: 20px;
font-weight: bold;
}
With this custom module code:
<div id="fb-head" class="hidden_div"> </div>
<div class="fb-like-box" data-href="https://www.facebook.com/pages/CJ1280-Radio/168180086627809?ref=ts&fref=ts" data-height="513px" data-colorscheme="light" data-show-faces="false" data-header="false" data-stream="true" data-show-border="false"> </div>

Custom content sharing on facebook

I am working on a share button on facebook. I want it to display a custom message in the description of the content sharing but I am unable to do so. Below is the code that I am working on,
<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>
<style> html .fb_share_button {
display: -moz-inline-block;
display:inline-block;
padding:1px 20px 0 5px;
height:15px;
border:1px solid #d8dfea;
background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right;
}
html .fb_share_button:hover {
color:#fff;
border-color:#295582;
background:#3b5998 url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right;
text-decoration:none;
}
</style> <a rel="nofollow" href="http://www.facebook.com/share.php?u=<;www.adsterr.com>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a>
Please help me out with the values of u,t and other parameters so I can make it work. Thanks
The facebook share button has been deprecated, you can read it here: http://developers.facebook.com/docs/share/
The Share button has been deprecated in favor of the Like button, and
will no longer be supported. Please use the Like button whenever
possible to drive maximum traffic to your apps.
Instead of that you can either use one of the social plugins:
https://developers.facebook.com/docs/plugins/ (such as the Like Button, Send Button or the Like Box) or open the facebook dialogs yourself using the facebook javascript sdk: http://developers.facebook.com/docs/reference/javascript/FB.ui/

Change the custom text ( Comment · Like· Share) when posted on profile page using facebook share functionality

I have a facebook iframe application with share functionality. Currently when i share something its showing the custom text Comment · Like· Share when posted on profile page.
I want to give customized text like view result etc.
How can i achieve this please guide me ?
I am using the code
<script>function fbs_click() {u='<?php echo $shareURL;?>';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><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://b.static.ak.fbcdn.net/rsrc.php/z … 8q506x.gif) no-repeat top right; } html .fb_share_button:hover { color:#b5b8d3; border-color:#295582; background:#3b5998 url(http://b.static.ak.fbcdn.net/rsrc.php/z … 8q506x.gif) no-repeat top right; text-decoration:none; } </style> Share
Thanks
If you're using Facebook's dialogs you can specify custom action links with your posts, but if you're using the old sharer.php this isn't possible.