How To Add Together A Thumbnail Image/Photo Gallery Inwards Blogger

For those who would similar to demo pictures inwards an paradigm gallery, here's a beautiful gallery made amongst JavaScript too CSS. This paradigm gallery displays the available thumbnails either vertically or horizontally on transcend of the chosen picture, thence making it easier for yous to pick dissimilar images on mouse click.

With the aid of CSS, nosotros tin brand the <img> chemical gene to display on same set amongst the residual of the thumbs too means the thumbnails equally modest blocks amongst a defined summit too width. The script volition add together a click-event for each <li> object that changes it's child's <img> visibility too volition assign an "active" course of pedagogy advert to the <li>.

Related: Image Slider amongst Mouse Hover Effect using CSS only


How to Add Image Gallery amongst Thumbnails to Blogger

Step 1. Log inwards to your Blogger account, select your weblog too larn to "Template", press the "Edit HTML" button.


Step 2. Click anywhere within the code expanse too press the CTRL + F keys to opened upward the search box:


Step 3. Type the next tag within the search box too hitting Enter to uncovering it:
</head>
Step 4. Now pick i of the styles below too re-create the code below it:


<style type='text/css'>
#image-gallery {display: none;}
  #jquery-gallery {padding:0;margin:0;list-style: none; width: 500px;}
  #jquery-gallery li {width:84px; height: 80px;background-size: 100%;-webkit-background-size: cover;-moz-background-size: cover; -o-background-size: cover;background-size: cover;margin-right: 10px; border: 3px enterprise #fff; outline: 1px enterprise #E3E3E3; margin-bottom: 10px;opacity: .5; filter:alpha(opacity=50); float: left; display: block; }
#jquery-gallery li img { position: absolute; top: 100px; left: 0px; display: none;}
  #jquery-gallery li.active img { display: block; border: 3px enterprise #fff; outline: 1px enterprise #E3E3E3; width:490px; max-height: 375px;}
  #jquery-gallery li.active, #jquery-gallery li:hover { outline-color: #DFDFDF; opacity: .99;filter:alpha(opacity=99);}
#gallery-caption {background: rgba(0, 0, 0, 0.3);color: #fff;font-size: 16px;font-weight: bold;left: 3px;position: absolute;text-align: center;top: 103px;width: 490px;text-transform: uppercase;}
</style>


<style type='text/css'>
#image-gallery { display: none; }
#jquery-gallery {padding:0;margin:0;list-style: none; width: 200px; }
#jquery-gallery li {background-size: 100%;-webkit-background-size: cover;-moz-background-size: cover; -o-background-size: cover;background-size: cover;margin-right: 10px; width: 80px; height: 80px; border: 3px enterprise #fff; outline: 1px enterprise #ddd; margin-right: 10px; margin-bottom: 10px; opacity: .5;filter:alpha(opacity=50); float: left; display: block; }
#jquery-gallery li img { position: absolute; top: 0px; left: 200px; display: none; }
#jquery-gallery li.active img { display: block; width:370px; border: 3px enterprise #fff; outline: 1px enterprise #E3E3E3; }
#jquery-gallery li.active, #jquery-gallery li:hover { outline-color: #bbb; opacity: .99;filter:alpha(opacity=99);}
#gallery-caption {background: rgba(0, 0, 0, 0.3);color: #fff;font-size: 16px;font-weight: bold;text-transform: uppercase;margin: 0 -17px;position: absolute;right: 0;text-align: center;top: 3px;width: 370px;}
</style>
Note: The display: none; for the starting fourth dimension ID (#image-gallery) is to preclude images look amongst their actual size earlier they larn within the gallery container.

In #jquery-gallery nosotros accept the width of the container for the thumbnails (200px), so that they display inwards ii rows too for this nosotros require to calculate the width of the thumbnail (80px) addition the margins betwixt them.

The left proclamation of #jquery-gallery li img is to motion the larger thumbnail that shows on mouse click so that it doesn't overlap amongst the smaller thumbnails.

Step 5. Paste the code of the chosen means only inwards a higher house the </head> tag.

Step 6. Now inwards a higher house the same </head> tag, add together this script:
<script type='text/javascript'>
//<![CDATA[
var gal = {
init : function() {
if (!document.getElementById || !document.createElement || !document.appendChild) provide false;
if (document.getElementById('image-gallery')) document.getElementById('image-gallery').id = 'jquery-gallery';
var li = document.getElementById('jquery-gallery').getElementsByTagName('li');
li[0].className = 'active';
for (i=0; i<li.length; i++) {
li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';
li[i].title = li[i].getElementsByTagName('img')[0].alt;
gal.addEvent(li[i],'click',function() {
var im = document.getElementById('jquery-gallery').getElementsByTagName('li');
for (j=0; j<im.length; j++) {
im[j].className = '';
}
this.className = 'active';
document.getElementById('gallery-caption').innerHTML = this.title;
});
}
},
addEvent : function(obj, type, fn) {
if (obj.addEventListener) {
obj.addEventListener(type, fn, false);
}
else if (obj.attachEvent) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent("on"+type, obj[type+fn]);
}
}
}
gal.addEvent(window,'load', function() {
gal.init();
});
//]]>
</script>
Basically, what this script does is to depository fiscal establishment tally if at that spot is whatsoever ID named "image-gallery" too larn the dissimilar listing items that may be within it. These elements volition move displayed equally thumbnails too a business office volition create upward one's heed what to produce i time they are clicked. So, each fourth dimension nosotros click on a thumbnail, the "active" course of pedagogy volition move assigned too the thumbnail should move visible inwards the larger container.

Step 7. Finally, salvage the changes past times clicking the "Save template" button.

And here's the HTML code providing a normal listing amongst the image-gallery ID, enclosed within a DIV amongst a relative set inwards club to avoid side effects of other pre-existing positions.

Step 8. Paste the below HTML to where yous desire to display the gallery past times going either to "Layout" too adding a novel gadget (click on the "Add a gadget" link too conduct "HTML/JavaScript" option), or within a post/page inwards the HTML section.
<div style="position:relative;">
<ul id="image-gallery">
<li><img src="IMAGE-URL1" /></li>
<li><img src="IMAGE-URL2" /></li>
<li><img src="IMAGE-URL3" /></li>
<li><img src="IMAGE-URL4" /></li>
<li><img src="IMAGE-URL5" /></li>
</ul>
</div>
Note: if elements on your page overlap amongst this gallery, yous mightiness require to add together the height proclamation later "position: relative;". The value of summit depends on the size of your gallery.

Example:
<div style="position:relative; height: 500px;"> 
Change IMAGE-URL1 amongst the paradigm URL. If yous don't know how to larn the address of an image, run across this tutorial: How to Upload Images too Get the URL

In instance yous require to brand the pictures clickable, add together this HTML construction instead:
<div style="position:relative;">
<ul id="image-gallery">
<li><a href="page-URL"><img src="IMAGE-URL1" /></a></li>
<li><a href="page-URL"><img src="IMAGE-URL2" /></a></li>
<li><a href="page-URL"><img src="IMAGE-URL3" /></a></li>
<li><a href="page-URL"><img src="IMAGE-URL4" /></a></li>
<li><a href="page-URL"><img src="IMAGE-URL5" /></a></li>
</ul>
</div>
Again, hither yous require to supercede the page-URL text amongst the URL of your page/post.

Update: To add together captions, delight include the lines inwards orangish too so supercede the "Caption" amongst the text that yous desire to look on each picture:
<div style="position:relative;">
<ul id="image-gallery">
<li><a href="page-URL"><img alt="For those who would similar to demo pictures inwards an paradigm gallery How to add together a thumbnail image/photo gallery inwards Blogger" src="IMAGE-URL1" /></a></li>
<li><a href="page-URL"><img alt="For those who would similar to demo pictures inwards an paradigm gallery How to add together a thumbnail image/photo gallery inwards Blogger" src="IMAGE-URL2" /></a></li>
<li><a href="page-URL"><img alt="For those who would similar to demo pictures inwards an paradigm gallery How to add together a thumbnail image/photo gallery inwards Blogger" src="IMAGE-URL3" /></a></li>
<li><a href="page-URL"><img alt="For those who would similar to demo pictures inwards an paradigm gallery How to add together a thumbnail image/photo gallery inwards Blogger" src="IMAGE-URL4" /></a></li>
<li><a href="page-URL"><img alt="For those who would similar to demo pictures inwards an paradigm gallery How to add together a thumbnail image/photo gallery inwards Blogger" src="IMAGE-URL5" /></a></li>
</ul>
<div id="gallery-caption"></div>
</div>

Save the widget or discover your page too you're done adding the thumbnail paradigm / photograph gallery inwards Blogger.

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel