Answer the question
In order to leave comments, you need to log in
A drop down gallery of pictures?
Good afternoon. There is a small gallery with n-th number of images, some of which are hidden.
How to implement the element of revealing the rest of the pictures on button click? For this to happen, obviously, without reloading the page. (Like, for example, on this site seo-ok.com , section - "Our clients")
Answer the question
In order to leave comments, you need to log in
A bad option, but simpler, a static height block with overflow: hidden and the height changes on button click.
Good option: AJAX and loading additional elements. In the example you provided, it is implemented like this:
$('#ow-carousel > div > .button a').on('click',function () {
$.ajax({
url: "ajax/more"+scount+".html",
cache: false,
beforeSend: function() {
$(this).hide().before('<img src="image/load.gif" alt="load" />');
},
success: function(html){
$('#ow-carousel > div > .button').before(html);
$('#ow-carousel > div > .button > img').remove();
$('#ow-carousel div.portion:hidden').fadeIn();
scount -= 1;
if(scount) {
$(this).show();
} else {
$('#ow-carousel > div > .button').remove();
}
}
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question