Jquery 'Justified Gallery' reload/reinitilse -
im using jquery 'justified gallery' plugin display pictures. im uploading pictures picture folder. im trying reinitilise or reload gallery when image uploaded (this example use refresh button).
the documentation states:"can called again update layout (after add or remove of images)". when attempt ignored , requires page reloaded make change.
this should simple...what doing wrong?
//initilise gallery $(window).load(function() { $('#layout-gallery').justifiedgallery({ rowheight : 300, margins : 15, captions : true, imagesanimationduration : 1000 }); //refresh gallery $('#refresh').on('mousedown', function(e) { $('#layout-gallery').justifiedgallery({ rowheight : 300, margins : 15, captions : true, imagesanimationduration : 1000 }); }); }
me being stupid...it reloading gallery! needed re-call php function gathered images, did this:
function initilisegallery() { $.get('php/data/output-layouts.php?outputgallery=true',function(data) { $('.gallery-container').html(data); $('#layout-gallery').justifiedgallery( { rowheight : 300, margins : 15, captions : true, imagesanimationduration : 1000 }); }); }
which loads (via ajax) php images wrapped in 'layout-gallery' div 'gallery-container' div(on main page). re-initiled plugin. calling method when uploading complete reloaded gallery contents.
Comments
Post a Comment