How to add a thumbnail block ( kinda )

Permalink
Hello there,

I just started working with concrete 5 and i ran into something. I got somethings figured out like how to add a content block etc. but now i like to add thumbnails ( I'm working on mine portfolio website ). of my work.

I will try to explain how i set it up in html/css:

Html :

<div id="portfolio2">

<div class="child">
<a href="glow.html">
<img src="images/glow.jpg" onmouseover="src='images/glow_hover.jpg'" onmouseout="src='images/glow.jpg'" alt="glow">
</a>
</div>

</div>

Inside the portfolio div there are 8 of those child div's all with there own thumbnail and they link to the page of their content.

The css for those items :

#portfolio2{
height: 100%;
width: 100%;
background: #f6f6f6;
}

.child{
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
width: 25%;
float: left;
border: 1px solid #727272;
}

img{
height: 100%;
width: 100%;
}

As you can see the thumbnails are 25% of the width each row has 4 thumbnails next to each other and they float left so the fifth++ will go one row lower. On other devices like iPad they get the width 33% and on mobile 50% .

To get the same height as width i also use this code :

window.onresize = function(event) {
var cw = $('.child').width();
$('.child').css({
'height': cw + 'px'
});
}

Now what do i want ?:

I would like to have the option in my website that i can add those child divs/thumbnails. So when i create a block the block consists off :

<div class="child">
<a href="glow.html">
<img src="images/glow.jpg" onmouseover="src='images/glow_hover.jpg'" onmouseout="src='images/glow.jpg'" alt="glow">
</a>
</div>

with the option to choose the images and add a link. I tried using the image block but then the image does not use the child styling so it won't float left, be 25,33,50% etc.

I hope you understand what the problem is and hopefully there is a way to get this working .

Cheers,
Jocko

 
Blenderite replied on at Permalink Reply
Blenderite
In my opinion, you are doing this the hard way. There are a bunch of add-ons that will do this for. And a lot easier on your side of things.

I think that to get what you are wanting, you should choose two addons:

http://www.concrete5.org/marketplace/addons/list-files-from-set/...

http://www.concrete5.org/marketplace/addons/image-list-templates/...

Install both of these and then add you pictures using the File Manager. Add them to a file set. Then go to the page that you want your portfolio on and add the List Files From Set block. Choose the set you just created. Then click add. It will not look how you want it right away. To make it look like a portfolio, click on the block, in the menu that pops up, select Custom Template. Choose one that looks good. That is it!!!

I threw a test portfolio together in less than 5 minutes using this method. Let me know it it works like you want it to. If you choose not to go this route, let me know. I might be able to help you with that code you have.
jocko replied on at Permalink Reply
I tried the add-ons but they do not full fill my needs, still thanks for the tip i think i can use them in the future.

Maybe if you can look at the plain html version you get an idea of what i want.

http://www.josweber.nl/index/

As you can see i really want them to fill up the screen and when you change the size of the screen the blocks need to adjust and also link to the product page.

I also tried using an html block but than the images won't show and off course a html block isn't the best way to go, its not gonna make it more user friendly.

isn't there a way to make a block that consists of html ( the child div container ) and then choose an image that has a hover and link?
Blenderite replied on at Permalink Reply
Blenderite
I believe this is what you are looking for.

http://jsfiddle.net/rbVZS/

To test it you can copy the contents of the HTML section and paste it into Textpad or Bluefish, and save it as a .html. Then open it in your browser. I was able to zoom in and out on the screen and it adjusted to accommodate the new width.
jocko replied on at Permalink Reply
I tried the code but it did not adjust the images. The width did but the height stayed the same thats why i used the javascript which fixes that.

But if that also fixes your script how can i get that inside a block element ?

I was thinking about a block inside a block ? is this possible ?
Blenderite replied on at Permalink Best Answer Reply
Blenderite
Ok, to put this into a block, copy and paste into a HTML block. There is not a way to put a block within a block.

I made a few changes to the code:

http://jsfiddle.net/rbVZS/1/
jocko replied on at Permalink Reply
Got it working thanks for the help! Maybe the html block isn't the most user friendly way but it works for now so thats great.

Great community over here props for that!!
Blenderite replied on at Permalink Reply
Blenderite
"Mark As Best Answer" helps :D
JohntheFish replied on at Permalink Reply
JohntheFish
You could have a look at some of the page list variations form Dojo - Folio Slider and a few others that do similar.