Skip to content

Heights, images, loading, etc #431

@chriscoyier

Description

@chriscoyier

Email from Andreas Doelling who didn't have a GitHub account and wanted to leave a comment:

............

I think I have discovered a bug in the new version (1.8.6) of Anythingslider that can be fixed with one small line of additional code as far as I can see.
I have no Github account so I hope it is ok to send you my bug report and suggested fix via e-mail.

The problem only appears in sliders with flexible height whose panels contain images (and only in Firefox and Chrome as far as I can see): if images haven’t been loaded when the slider is initialised the panels’ heights are not set correctly.

The relevant lines are these in base.setDimensions():


h = (c.length === 1 ? c.outerHeight(true) : t.height()); // get height after setting width

if (h <= base.outerPad[1]) { h = base.height; } // if height less than the outside padding, then set it to the preset height

t.css('height', h);


The problem is that you set the panel’s height to t.height() when setDimensions() is called initially.
Now, when setDimensions() is called a second time on window.load – the height does not get changed because t.height() is t.height() is t.height() …
;)

My quick fix is to reset the height of the panel:


t.css('height', 'auto');

h = (c.length === 1 ? c.outerHeight(true) : t.height()); // get height after setting width

if (h <= base.outerPad[1]) { h = base.height; } // if height less than the outside padding, then set it to the preset height

t.css('height', h);


Do you agree? Or am I totally mistaken? (I had a long working day so, maybe, I’m missing something.)

Anyway, I love Anythingslider and have been using it for a bunch of very different and complex variations. Thanks for this plugin and keep up your great work!

Bye,
Andreas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions