Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript anythingSlider hidden then shown doesn’t work… Re: anythingSlider hidden then shown doesn’t work…

#78178
prot3us
Member

Oh, I’ve sorted it now.

instead of jamming two functions into one I’ve created two separate functions that work with the same trigger.

so, instead of

Code:
$(‘#orderingCompressed, #closeFull’).click(function () {
if ($(‘#orderingFull’).is(‘:hidden’)) {
$(‘#orderingFull, #orderingCompressed’).slideToggle();
$(‘.anythingSlider’).anythingSlider({});
} else {
$(“#orderingCompressed, #orderingFull”).slideToggle().unload(“.anythingSlider”)
}
});

I’ve got

Code:
$(‘#orderingCompressed, #closeFull’).click(function () {
$(‘#orderingFull, #orderingCompressed’).slideToggle();
});
$(‘#orderingCompressed’).one(‘click’, function () {
$(‘.anythingSlider’).anythingSlider({}); });
});

you can see on this example page that I made…

http://www.cyber-connexions.co.uk/test/ … gpart.html

I knew that I’d need two functions but I was doing it based on whether the slider div was shown or not (then trying to load the slider and unload it). Now I just create the slider once the first time that the smaller div is clicked. Seems so easy now that it’s done. It also means that I don’t have to keep adding and removing stuff from the DOM which is the route I’d started heading down.

Thanks anyway. I hope this helps someone else too :)