Why first time is not computed height in JS?

There is a slider. Example page tommy.1gb.ru/leather
Tell me, please, why when you reduce the width of the screen, not visceversa the first time the height of the arrows. I.e. the arrows of paging when the page loads is higher than it should. If a little to resize the window, they fall into place. Running the piece
jQuery(window).on("resize", function(event) {
methods.setResponsiveEvents();
 var innerWidth = jQuery(listParent).width();
 var innerHeight = jQuery(listParent).height();

Everything is calculated and falls into place.
Tell me why if the width of the window everything is fine, but when this little oopsie...
At initialization, see called onresize
Public Methods
*******************************/
 var methods = {
 init : function() {
 return this.each(function() {
methods.appendHTML();
methods.setEventHandlers();
methods.initializeItems();
});
},

/******************************
 Initialize Items
 Fully initialize everything. Plugin is loaded and ready after finishing execution
*******************************/
 initializeItems : function() {

 var listParent = object.parent();
 var innerHeight = listParent.height();
 var childSet = object.children();
methods.sortResponsiveObject(settings.responsiveBreakpoints);

 var innerWidth = listParent.width(); // Set widths
 itemsWidth = (innerWidth) / itemsVisible;
childSet.width(itemsWidth);
 if (settings.clone) {
childSet.last().insertBefore(childSet.first());
childSet.last().insertBefore(childSet.first());
object.css({
 'left' : -itemsWidth
});
}

object.fadeIn();
 jQuery(window).trigger("resize"); // needed to position the arrows correctly

 },

Please do not kick because JS is not strong )
July 9th 19 at 10:39
2 answers
July 9th 19 at 10:41
Add alert(listParent) in the "onresize" to make sure that this variable is at the time of resizing.
Issues https://s.mail.ru/AB8D/TtLwVrB8e
Tried to display height. The first time she is 39 and got 160 - lemuel.Zie commented on July 9th 19 at 10:44
"The first time" is what time you mean. Immediately after opening the page (trigger("resize")) or after all images are loaded, first time is driven by the size of the browser?
If the first - then picture can not manage to boot, hence the height is wrong. - Daphne_Roob commented on July 9th 19 at 10:47
The first time I mean when the page is loaded, if not to touch anything.
"If the first - then picture can not manage to boot, hence the height of wrong" - that I immediately thought of this. But if the window width is large, it is in fact all normal. - lemuel.Zie commented on July 9th 19 at 10:50
Perhaps there are more scripts that implement, for example lazy loading of images lazyload. - Daphne_Roob commented on July 9th 19 at 10:53
No. Nothing like like no. Do not tell me how then you can wait for image loading, and only then to implement what you need. - lemuel.Zie commented on July 9th 19 at 10:56
Usually the problem with downloading images is originated when the scripts are run via: $(document).ready(function () { ... }); and replace it by $(window).load(function () { ... }); (jQuery)
But I have not see the code that performs these methods. - Daphne_Roob commented on July 9th 19 at 10:59
July 9th 19 at 10:43
Easier to do absolute positioning with CSS and everything will be as needed

.nbs-flexisel-container {
 height: 180px;
}

.nbs-flexisel-nav-left, .nbs-flexisel-nav-right {
 position: absolute;
 top: 50%;
 margin-top: -15px;
}
and what if on another page tommy.1gb.ru/stitches where image height is different? - lemuel.Zie commented on July 9th 19 at 10:46
: well, ask this block-wrapper then the height with js the same as in the picture - Daphne_Roob commented on July 9th 19 at 10:49

Find more questions by tags JavaScript