Web Designers' Edge – The Self-Taught Designer's Best Friend

Using CSS To Use A Custom ShareThis Icon Or Image

ShareThis icon customIt’s pretty annoying how little instruction there is to change the ShareThis icon to something else. So I took a stab at finding my own solution without needing to modify javascript code or API calls. Frankly, the freshest information about it was 2 years old. And very paltry and not very helpful.

The issue is that when you get the share widget from the ShareThis website, there are only a couple options for the styling of the button. And the javascript code that you get does not have an image URL in it that you could easily modify to your own image. I even tried copying the javascript that loads from the ShareThis site and loading it from my own site, with modifications. But that didn’t work.ShareThis Image Options What I wanted was a large icon that when moused over would show the sharethis dropdown of all the social sharing options. However, there is no large icon option. Just a few different small icon options that were not going to match my client website icons. So, time to make it my way.

The image was going to appear in a group of icons for navigation. The sharethis icon needed to fit right into the middle of them. Since I was already using some hover css that I’m fond of using for icons like this, avoiding having to use jquery and for that, maybe making the site somewhat more accessible, I went ahead with that. I do this with an object tag to wrap a div inside a link tag, so it will validate.

Then all I did was create another div inside that one, to insert the sharethis javascript code. The HTML for the list menu item down to the javascript looked like this:

<li>
<a href="http://example.com/about">
<object>
<div class="menu-share">
---share this javascript goes here---
</div>
</object>
</a>
</li>

So there are the .menu-share div to show the button, as well as help me hide the image that sharethis will load, without hiding the functionality. All that’s left is the .css:

.menu-share {
background: url('images/share-icon.png') no-repeat 0 top;
height: 56px;
width: 57px;
float: left;
margin: 0 20px;
}
.menu-share:hover {
background-position: 0 -57px;
cursor: pointer;
}
.menu-share img {
display: none;
}

The last little bit just hides any image inside the div. It does not hide the background image, only images that load inside the div. However, all the javascript is still fully functional, loading the social media dropdown as it should.

ShareThis Dropdown

About the Author

Tim Norton started designing websites in his free time in 2005 and it soon became a major source of income for his family. He taught himself coding, graphics, and whatever else relates to designing great websites. Get in touch at 6Webdesign.

Like This? Please share it now!

  • Pingback: Are there any pre-made forms to have visitors to my web site upload files? | BingSite

  • Pingback: Defonic International Solutions

  • http://www.air-jordan-11.com/ air jordan 11

    Here elaborates the matter not only extensively but also detailly .I support the
    write's unique point.It is useful and benefit to your daily life.You can go those
    sits to know more relate things.They are strongly recommended by friends.Personally!http://kite8.net/

  • http://www.chaneloutletstores.com chanel

    It looks good,I have learn a recruit!
    Recently,I found an excellent online store, the http://www.chaneloutletstores.com are completely various, good quality and cheap price,it’s worth buying!
    write's unique point.It is useful and benefit to your daily life.You can go those chanel chanel outlet chanel store cheap chanel discount chanel chanel on sale chanel for sale chanel leather Chanel bags chanel handbags chanel purses chanel wallets chanel Luggage chanel travel bags chanel shoes chanel boots chanel Accessories chanel belts chanel jewelry chanel scarves Chanel glasses chanel sunglasses chanel clothing chanel dress chanel bikini thefer net Like-Acer tiny let-lands iamateacherithink
    sits to know more relate things.They are strongly recommended by friends.Personally
    I feel quite well.

  • http://increaserss.com/ Increase RSS

    Cool man thanks.

  • http://sorebuttcheeks.blogspot.com/ Anabolic Steroids

    the standard icons are bad great to be able to create your own new ones.

  • http://www.domain-hosting-services.in/ Domain name web hosting

    I know little bit about CSS and it is a place where we can share designs and images. Thanks for this new information.

  • http://www.imperiousseo.com SEO USA

    Really cool information. Thanks for sharing about this information.

  • http://www.imperiousseo.com zoekmachine optimalisatie

    I like CSS and it’s a places where we can see so many new new designs and also we can share our designs with our site.