Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Function not being updated correctly Reply To: Function not being updated correctly

#236192
Alen
Participant

@shikkediel didn’t know that was being removed. Just shows how much I’ve been working with jQuery, mostly using VueJS.


@xvilo
I’ve replicated your issue by creating locally:

  1. index.html and copy your markup
  2. demo.html so I can navigate between pages (same markup)
  3. added following JavaScript (re-wrote some parts)
$(document).ready(function() {
    calcLeftWrapper();
});
$(window).resize(function() {
    calcLeftWrapper();
});

function calcLeftWrapper() {
    var $original = $('.original-width');
    var $divWidth = $original.width();
    var $divPosit = $original.offset();
    var $vph = $(window).height();
    var $element = $('.leftwrapper');
    var $height = $vph - $divPosit.top - 15;
    $element.css({
        'width': $divWidth,
        'left': $divPosit.left,
        'top': $divPosit.top,
        'height': $height,
        'display': 'block',
    });
}

Everything is working as expected.

Hope that helps,
Alen