Tampilkan postingan dengan label css. Tampilkan semua postingan
Tampilkan postingan dengan label css. Tampilkan semua postingan

Kamis, 30 Januari 2014

Horizontal Popular Post Widget using CSS


'Recent Posts' widget or 'Popular Posts' widget is very essential widget (or gadget) for blogger blog. This widget displays your blog popular posts based upon some analytic result along with snippet, images etc which are also optional. By default blogger provides some styles for this widget but somehow these are obsolete and unprofessional. I have written quite a few posts about customization of this widget. This post is also one of those customization but a little different. Here i shall show you how to display popular posts or recent posts in horizontal manner instead of vertical. The main and only problem is that it requires larger horizontal space i.e. larger width of of your blog. So before you proceed, make sure you have enough room in your blog to display posts horizontally.

    Features :
  • Full control over 'Image thumbnail' view.
  • Full control over 'Snippet' view.
  • If you have checked 'Show image thumbnail' but unfortunately your blog post contains no image, then image thumbnail will be automatically filled by a preassigned image (no-image) as shown in the figure.
Screenshots :
All right, let's proceed.
Before you make any changes in your blogger template, it is recommended to backup your blog in case something goes wrong.
It is just a cautionary statement. Don’t get scared. Just stay serious.
Let's proceed.
  1. Sign in to Blogger.
  2. Click the Drop-down arrow adjacent to 'Go to post list' icon.
  3. Click 'Layout' form the drop-down menu list. It will take you to the layout section of different widgets (or gadgets) of your blog.
  4. Click 'Add a Gadget' link as shown in the fig below. A new window will open that contains list of all gadgets available.
  5. Scroll down and when you see 'Popular Posts' gadget, click on it or click the '+' icon as shown in fig below.
  6. This will take you to a new window named as 'Configure Popular Posts'.
    • Select the 'Most viewed' option to 'All time' .
    • Select number of the post(s) in 'Display up to' section.
    • Check 'image thumbnail' if you want to show it, otherwise leave it as unchecked.
    • Check 'snippet' if you want to show some post texts along with its title.


  7. Hit 'Save'
  8. If your blog already contains this widget, you don't need to repeat the part that has been discussed so far.
  9. Click 'Template'
  10. Click 'Edit HTML'.
  11. Make sure that 'Expand Widget Templates' is checked. If you are using new interface of blogger, you don't have to do this part. 'Expand Widget Template' is checked by default in blogger new user interface.
  12. Search for (
    Ctrl
    +
    f
    ) </b:skin and paste these codes before </b:skin
  13. /*--Horizontal Popular Post using CSS by Bloganalyzer --*/
    
    .PopularPosts li{
    display: inline;
    list-style: none;
    width: 200px;
    height: 150px;
    float: left;
    text-align: justify;
    background: #e4e4e4;
    border: 1px solid #333333;
    color: #11111;
    margin: 5px;
    padding: 5px;
    line-height: 1.2em;
    }
    .PopularPosts .item-title{
    text-align: left;
    width: 200px;
    font-size: 20px;
    background: #afafaf;
    padding: 5px;
    border-bottom: 1px solid #868686;
    border-right: 1px solid #868686;
    margin-bottom: 5px;
    }
    .item-thumbnail img{
    height: 80px;
    width: 80px;
    }
    
  14. Click on 'Jump to widget', select 'PopularPosts1' from the drop down menu (if you are using blogger new interface) and find 'Show snippets and thumbnails'. You can also search for 'Show snippets and thumbnails' (applicable for both new and old interface)
  15. You will find a code something like that
  16. <!-- (4) Show snippets and thumbnails -->
      <div class='item-content'>
        <b:if cond='data:post.thumbnail'>
          <div class='item-thumbnail'>
            <a expr:href='data:post.href' target='_blank'>
              <img alt='' border='0' expr:height='data:thumbnailSize' expr:src='data:post.thumbnail' expr:width='data:thumbnailSize'/>
            </a>
          </div>
        </b:if>
        <div class='item-title'><a expr:href='data:post.href'><data:post.title/></a></div>
        <div class='item-snippet'><data:post.snippet/></div>
      </div>
    
  17. Replace that code with this code. I should remind you to backup your template before any further movement.
  18. <!-- (4) Show snippets and thumbnails -->
      <div class='item-content'>
        <div class='item-title'><a expr:href='data:post.href'><data:post.title/></a></div>
        <b:if cond='data:post.thumbnail'>
          <div class='item-thumbnail'>
            <a expr:href='data:post.href' target='_blank'>
              <img alt='' border='0' expr:height='data:thumbnailSize' expr:src='data:post.thumbnail' expr:width='data:thumbnailSize'/>
            </a>
          </div>
        <b:else/>
          <div class='item-thumbnail'>
            <img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK9L8P0WXpwjmObAUJU3ijNEXfhxUA9ysrGO9GyLnD85a5Zmn8UmoDPtqM1u4ce2CLwVo_KQb-_jZhFIYRAJnmniUs4ST9gTgSa6v3bUO1fFskhPjKfHpqFQBX7IN-8tgiZsyw_mE0gHs/s400/noimage.png'/>
          </div>
        </b:if>
        <div class='item-snippet'><data:post.snippet/></div>
      </div>
    
  19. Hit 'Save template'
If you have any questions on this, please let me know. Enjoy !

Create a CSS Image Slider with Thumbnails

Image galleries/sliders are particularly useful for photoblogs, but they could also serve those who occasionally need a gadget like this. As we saw in a previous tutorial, on the top of the block we had some small thumbnails which were enlarged at the bottom each time an image was selected. The difference is that there we had to click the thumbnail in order to show a larger version and that was acquired with JavaScript.

This time will use only hover and CSS.


Step 1. Log in to your Blogger Dashboard and go to Template > Edit HTML


Step 2. Click anywhere inside the code area and press the CTRL + F keys to open the Blogger search box


Step 3. Paste the </head> tag inside the search box and hit Enter.

Step 4. Just above the </head> tag, add this code:
<style type='text/css'>
.image-container {
position: relative;
width: 640px;
height: 530px;
margin: 0 auto;
text-align:center;
overflow: hidden;
}
.image-container a {
display: inline;
text-decoration: none;
}
/* Mini-thumbnails style */
.mini-thumbnail {
width: 18%; /* mini-thumbnails width */
margin:1px;
opacity: 1;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.5);
box-shadow: 0px 0px 3px rgba(0,0,0,0.5);
}
/* Style for the main thumbnail */
.large-thumbnail {
position: absolute;
width: 100%;
top: 800px;
margin:0 auto;
text-align: center;
display: block;
-webkit-transition: top 1s ease;
-moz-transition: top 1s ease;
-o-transition: top 1s ease;
-ms-transition: top 1s ease;
transition: top 1s ease;
}
.feature {
top: 110px;
width: 100%;
opacity: .3;
}
/* style for the selected mini-thumbnail */
a:hover .mini-thumbnail {
opacity: .5;
-webkit-box-shadow: 0px 0px 10px rgba(0,0,0,0.5);
-moz-box-shadow: 0px 0px 10px rgba(0,0,0,0.5);
box-shadow: 0px 0px 10px rgba(0,0,0,0.5);
}
/* transition effects for the selected image */
a:hover .large-thumbnail {
top: 110px;
width: 100%;
z-index:3;
opacity: 1;
-webkit-transition: top 1s ease;
-moz-transition: top 1s ease;
-o-transition: top 1s ease;
-ms-transition: top 1s ease;
transition: top 1s ease;
}
</style>
Here we set a specific height (530px) and width (640px) so that we can slide an image out of the bounds of the container and have it be hidden (overflow:hidden);
The absolute positioning on the larger thumbnails (.large-thumbnail) pulls them out and places them specifically in the spot that we've chosen using a value of 800px for the top property;
The mini-thumbnails which are actually a second image remain all the time above in a static position and are altered only slightly in terms of style for distinguishing the active (a:hover .mini-thumbnail) on mouse over.
Step 5. Save the changes by clicking on the Save template button.

And finally, we need to add the HTML code.

Step 6. Paste the below HTML structure to where you want to display the gallery by going either to Layout and add a new gadget (click on the Add a gadget link and choose HTML/JavaScript), or inside a post or page within the HTML section.
<div class="image-container">
<a href="javascript:void(0);">
<img class="mini-thumbnail" src="MINI-THUMB-URL1" />
<img class="large-thumbnail" src="LARGE-THUMB-URL1" />
</a>
<a href="javascript:void(0);">
<img class="mini-thumbnail" src="MINI-THUMB-URL2" />
<img class="large-thumbnail" src="LARGE-THUMB-URL2" />
</a>
<a href="javascript:void(0);">
<img class="mini-thumbnail" src="MINI-THUMB-URL3" />
<img class="large-thumbnail" src="LARGE-THUMB-URL3" />
</a>
<a href="javascript:void(0);">
<img class="mini-thumbnail" src="MINI-THUMB-URL4" />
<img class="large-thumbnail" src="LARGE-THUMB-URL4" />
</a>
<a href="javascript:void(0);">
<img class="mini-thumbnail" src="MINI-THUMB-URL5" />
<img class="large-thumbnail" src="LARGE-THUMB-URL5" />
</a>
<a href="javascript:void(0);">
<img class="large-thumbnail feature" src="LARGE-THUMB-URL1" />
</a>
</div>
In this example we left the link empty (javascript:void(0);) but you can add one if you want - just replace javascript:void(0); with the url of your page/post.
To add pics inside the image slider just replace MINI-THUMB-URL and LARGE-THUMB-URL texts with the URL of your images. Note: The last LARGE-THUMB-URL1 should be replaced with the URL of the default image that will appear on your slider.