javascript - resposive layout of wordpress template -
absolutely pulling hair out on 1 don't know jquery. there seems no black , white solution offered anywhere.
basically, trying create fluid , responsive portfolio. width of column set 390px want smaller (320px) mobile devises screens < 480px. me 1 please
here code
(function($) { // $() work alias jquery() inside of function var ww = document.body.clientwidth; $(window).load(function(){ // masonry.js var $container = $('#posts'); $container.imagesloaded(function(){ $container.masonry({ itemselector: '.box', columnwidth: 390, isfitwidth: true }); }); });
@media (max-width: 481px) { .box{ width:100%; max-width:320px; } }
update:
if want use javascript have @ window.matchmedia
var mq = window.matchmedia( "(max-width: 481px)" ); if (mq.matches) { var mybox = document.queryselector(".box"); mybox.style.width = "320px"; /*****jquery var styles = { width:320px }; $(".box").css(styles); ****/ }
Comments
Post a Comment