javascript - Change margin, width, height, top, left, padding from all elements between a div -
javascript - Change margin, width, height, top, left, padding from all elements between a div -
i got design in total hd resolution, planned presentation in solution, want bit responsive. have alter these parameters: margin, padding, width, height, top, left on fly, maybe got solution me.
i tried next , works images width , height:
// set array resize (0 => width of window, 1 => resize (yes / no)?, 2 => how much per cent have set away var resize_pool = new array(parseint($(window).width()), false, 0); if(resize_pool[0] < 1920) { resize_pool[1] = true; resize_pool[2] = (100 * resize_pool[0]) / 1920; resize_pool[2] = 100 - math.floor(resize_pool[2]); } // have resize? if(resize_pool[1] == true) { $("#content img").each(function(index, element) { $(this).css('width', 'calc(' + $(this).width() + 'px - ' + resize_pool[2] + '%)').css('height', 'calc(' + $(this).height() + 'px - ' + resize_pool[2] + '%)'); }); }
this works fine, there improve solution, can alter values? margin, padding etc.
thanks help in advance
css media queries need utilize - e.g.
td { padding:20px; /* default padding size 1920px+ wide */ } @media screen , (max-width: 1919px) { td { padding:10px; /* smaller padding screens less 1920px wide; } }
javascript jquery html css
Comments
Post a Comment