On load and resize

Marko Krstić
19 Feb 2022
jQuery(document).ready(function($){
// Bind to the resize event of the window object
$(window).on("resize", function () {
    
    var container   = $( `#div_block-21-2` ).width();
    var docWidth    = $( window ).width();
    var final       = docWidth - ((docWidth - container) / 2);
    $('#hero-lines').css('width', final + 'px');
// Invoke the resize event immediately
}).resize();
		
});

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy