I have any existing jQuery on a page that changes the layout/masonry depending on the onclick selection. Content includes sections on advertising, music and photography. I would like to be to run the same functions when using a url hash.
Eg. foo.com/#advertising would run this specific function;
$('#show_advertising').click(function() {
$('.advertisingon').slideDown('fast', function() {
$masonry.masonry();
});
$('.advertisingoff').slideUp('fast', function() {
$masonry.masonry();
});
});
Here is the full query as it stands.
<script>
(function ($) {
$(document).ready(function(){
var $masonry = $('#masonry-content_fmzq1ep27, #masonry-content_HomeHeadingTy1, #masonry-content_HomeHeadingTy2, #masonry-content_HomeHeadingTy3, #masonry-content_HomeHeadingTy4, #masonry-content_HomeHeadingTy5,#masonry-content_HomeHeadingTy6, #masonry-content_HomeHeadingTy7, #masonry-content_HomeHeadingTy8, #masonry-content_HomeHeadingTy9, #masonry-content_HomeHeadingTy10');
$('#show_all').click(function() {
$('.allon').slideDown('fast', function() {
$masonry.masonry();
});
});
$('#show_music').click(function() {
$('.musicon').slideDown('fast', function() {
$masonry.masonry();
});
$('.musicoff').slideUp('fast', function() {
$masonry.masonry();
});
});
$('#show_advertising').click(function() {
$('.advertisingon').slideDown('fast', function() {
$masonry.masonry();
});
$('.advertisingoff').slideUp('fast', function() {
$masonry.masonry();
});
});
$('#show_photographer').click(function() {
$('.photographeron').slideDown('fast', function() {
$masonry.masonry();
});
$('.photographeroff').slideUp('fast', function() {
$masonry.masonry();
});
});
});
})(jQuery);
</script>
Many thanks!
window.location.hashcontains the current hash