How to Add Social Media Icons with Hover

Dec 17, 2014 17:29

Account Status: All
Theme: All
Actions: Social Media Icons with Hover
Requested by: dikana
Source: Icons Set

Trying to get this effect on your sidebar?


This is a very simple code:


You can put this in your blurb section of your sidebar. And by repeating it you'll get a set of social media icons, just put the links one right after another.

However it is possible you want to go from this:





to this:
See Sidebar at workshop_rees <-Because it stopped working in the post but is working in the sidebar of my test journal.

Let's start the process which isn't that hard really.
1. First things first. You need your images. Something you will notice about the images I gave you the link to (source link at the top of post) is that the hover images are separated from the color ones. This doesn't really work. They have to be one image. I'll put a border around them so you can see that the hover image is part of the color image. I did this but essentially this is what you'll look for online.





The reason for this is that the coding doesn't allow for a starting image and then a hover image but it does allow us to move what we are seeing in the image. So the link image is going to be the first 48px by 48px section which is the color image. Then the hover will move and show the second 48px by 48px section which is the hover image we want to see.

So you'll need to decide now what size you want your images to be. These are 48x48 (each double image is 48x96) but if you want smaller you can resize them to 36x36 which means that when you put them together in one image it will be 36x72 (double images together). If I were you I'd look for the hover images online unless you can make icons and can work with programs like Photoshop.

2. We need to set them up on our sidebar. Go to blurb section of your sidebar. Here you will be able to add them to your sidebar.



3. This might seem odd but there are actually no images to put in here. Each social media icon you are adding needs to be put in like this. The class is what will give them an image and hover capabilities.


Youtube
http://layout-lounge.livejournal.com/">RSS

4. Next we need to add some coding to your Custom CSS Layout. Above I gave the Facebook link the class of facebooklink which means I need to represent this in the coding. This applies to any social media icon you add. So if in the class I'd put tumblrlink then my coding would have to be .tumblrlink to get the coding to work.

Now going back to talking about what the image is showing in the coding: You'll notice that the facebooklink is set to width and height of 48px which is how big these circles are but my full image with hover image is 48px by 96px because it is double height. Right after the FACEBOOK IMAGE link it says top which means it is showing the first 48x48 of the top of the image.

However, you'll notice that in the facebooklink:hover it says the background position is 48px 48px. This is because we want it to start 48pxs down from the top of the image and be 48x48 to show the hover image. Got that?

Oh, extra note... the float coding means that they will appear one right after another so at the end of the step three coding I've added a < br > which ensures anything you want to add after he social media icons will start on the next link. You may need a < br > before the social media coding in step three if you have text before the icons on our sidebar.
.facebooklink {
display: inline-block;
width: 48px;
height: 48px;
background: url(FACEBOOK IMAGE) top;
text-indent: -99999px;
margin: 1px;
}
.facebooklink:hover {
background-position: 48px 48px;
}

.twitterlink{
display: inline-block;
width: 48px;
height: 48px;
background: url(TWITTER IMAGE) top;
text-indent: -99999px;
margin: 1px;
}
.twitterlink:hover {
background-position: 48px 48px;
}

.youtubelink{
display: inline-block;
width: 48px;
height: 48px;
background: url(YOUTUBE IMAGE) top;
text-indent: -99999px;
margin: 1px;
}
.youtubelink:hover {
background-position: 48px 48px;
}

.rsslink{
display: inline-block;
width: 48px;
height: 48px;
background: url(RSS IMAGE) top;
text-indent: -99999px;
margin: 1px;
}
.rsslink:hover {
background-position: 48px 48px;
}

5. Once you've saved the links to your sidebar and added this coding to your Custom CSS Coding (I like to stick it where I'm putting it so in my coding it would be in my sidebar section of the coding) and, of course, saved. You should be able to go to your journal, refresh and see the hover effect working. Sometimes there is a slight delay and you'll have to hover over them a second to get them working. But it should do the trick.

Hover Images I created from the source for your convenience.














Please do NOT hotlink these images. Save them to your computer and upload them into your own photo-sharing service.

If you have any questions or require additional help please comment to this post.

.all-themes, #account: all, help with: images, !layout-tutorials, help with: social media icons, image: social media, image, help with: links

Previous post Next post
Up