Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For a project we are building a responsive flexslider. Initially the flexslider has a height of 0px. When we resize the browser then the correct height is set.
We've found this issue in the flexslider issue queue:
https://github.com/woothemes/FlexSlider/issues/278
Attached is a patch that moves the initialization from drupal behaviors to window.load such that the images are loaded correct.
Comments
Comment #1
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedAnd a patch that includes actual code.
Comment #2
berliner CreditAttribution: berliner commentedComment #4
berliner CreditAttribution: berliner commentedThe patch applies properly and it solves the problem for me.
Tests also fail without the patch applied. So there must be something wrong with the tests. This is probably related to #1935156: Update tests to match changes in 2.x.
Comment #5
berliner CreditAttribution: berliner commentedAfter applying the patch the slide area flickers on page load.
Comment #6
Chimos CreditAttribution: Chimos commented+1
I have this problem too with alpha 1. On load (only sometimes), it doesen't fit the height of the image. When I skip to next image it adapts to actual height.
It happens too slideshows in full nodes and in views blocks too (both have smooth height active).
I'm sorry I can't provide more help. I'm not familiar with patches yet.
Comment #7
minorOffense CreditAttribution: minorOffense commentedI don't want to bind on window load since instances where images may be refreshed via Ajax (I.e. View with exposed filters and Ajax refresh) would break.
Is there a behavior in drupal we can listen on which is similar to window.load?
Comment #8
daroos CreditAttribution: daroos commented1: smooth-height-0px.patch queued for re-testing.
Comment #10
minorOffense CreditAttribution: minorOffense commentedPerhaps something from here can help us
http://stackoverflow.com/questions/16335050/flexslider-2-how-to-load-wit...
Comment #11
gittosj CreditAttribution: gittosj commentedIts a bug in the JS code which may have been fixed in the dev branch - see here:
https://github.com/woothemes/FlexSlider/issues/436
However i've just pulled and tested it and can;t see any difference from 2.2.2
Comment #12
alvar0hurtad0smooth-height-0px.patch queued for re-testing.
Comment #14
dancastellon CreditAttribution: dancastellon commentedFor anyone with this issue, for now you can apply this jQuery fix:
Comment #15
alvar0hurtad0Re-patching
Comment #17
alvar0hurtad0smooth-height-0px.patch queued for re-testing.
Comment #19
alvar0hurtad0Comment #20
alvar0hurtad015: 0001-Issue-2086525-by-alvar0hurtad0-Johnny-vd-Laar-Flexsl.patch queued for re-testing.
Comment #21
alvar0hurtad0Ok, Mr QA can you review the patch, please?
Comment #22
screeno CreditAttribution: screeno commentedI just want to report that I applied the patch given in #1 and it appears to have solved a problem with the first slide only partially loading. Additionally, it also cleared up a problem with the slideshow causing the browser to freeze when viewed on my iPhone.
Comment #23
scuba_fly#21 is working for me. Thanks!
Comment #24
grossmann CreditAttribution: grossmann commented#21 is working for me too.
I am not sure if
.bind
is ajax safe. With jQuery >1.7 we could use.on
as stated here: http://stackoverflow.com/a/20246940 which should work with ajax. Maybe.ajaxSuccess
is a solution for content loaded through an ajax request.I am not using ajax in my sliders so I didn't test this.
Comment #25
mErilainen CreditAttribution: mErilainen commentedWorks for me also.
Comment #26
jerry CreditAttribution: jerry commentedFor what it's worth, this issue still exists in 7.x-2.0-rc1 and its associated -dev. using library version 2.5.0. Patch in #21 no longer applies and probably requires a re-roll. JS snippet in #14 does work if .flex-viewport is replaced with .flexslider. Obviously, the AJAX compatibility issue is still unresolved.
Comment #27
zhinio CreditAttribution: zhinio commentedI am still having this problem. Anyone has a solution. #21 fails and i am not sure how to apply #14?!
Comment #28
tacituseu CreditAttribution: tacituseu commentedSame with 8.x-2.0-beta1.