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.
I noticed this annoying 5px padding on all my cycle containers which I couldn't remove with css as it becomes hard coded in views_cycle.js by the following jquery: cycler.height(tallest + verticalPadding);
The culprit is line 13: var verticalPadding = settings.verticalPadding || 5;
As far as I can tell there is no verticalPadding setting being set anywhere in the code so the fallback is chosen which is 5px. Can you change this to 0px please? Or add the verticalPadding setting somewhere? A fix would be changing line 13 to:
var verticalPadding = settings.verticalPadding || 0;
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#10 | 514236_views_cycle_fix.patch | 1.43 KB | imclean |
#6 | views_cyle_verticalpadding-514236_0.patch | 3.3 KB | imclean |
#5 | views_cyle_verticalpadding-514236.patch | 1.66 KB | imclean |
#4 | views_cycle_verticalpadding.patch | 1.14 KB | imclean |
#1 | views_cycle-514236.patch | 702 bytes | eabrand |
Comments
Comment #1
eabrand CreditAttribution: eabrand commentedHere's a patch
Comment #2
eabrand CreditAttribution: eabrand commentedComment #3
druplicate CreditAttribution: druplicate commentedI'm using this module to make a rotating auto-fade banner in the header-middle region using Acquia Marina and noticed the div heights were set to 160 pixels for an image height of 150 pixels.
I applied this patch and the other one at: http://drupal.org/node/551866
The other patch got rid of 5pxs but this one didn't get rid of any more. I still have div heights from inline styling set at the image size plus 5px, so now it's 155px as before it was 160px.
My code looks like this (from Firebug):
<div id="header-middle">
<div class="block-wrapper odd">
<div id="block-views-banner-block_1" class="block block-views">
<div class="content">
<div class="view view-banner view-style-normal view-id-banner view-display-id-block_1">
<div class="view-content">
<div class="views-cycle item-list" style="height: 155px;">
<ul id="views-cycle-banner-block_1" class="views-cycle-container viewsCycle-processed" style="height:155px;">
<div class="views-field-field-banner-image-fid">
<span class="field-content">
<img class="imagefield imagefield-field_banner_image" width="700" height="150" src="http://192.168.1.12/sites/default/files/images/girl_pool_0.png?1251475195" alt=""/>
There is an earlier div for the header-first (logo) region that is also adding 5px but not using inline styling or CSS - how is that possible? If I set all of the div heights for the first and second header regions to 150 px using Firebug, then everything is fine.
What am I missing?
Comment #4
imclean CreditAttribution: imclean commentedHere's a combined patch for
views_cycle_plugin_style_cycle.inc
andjquery.cycle.js
.The .inc patch adds the Vertical Padding setting to the Cycle views plugin settings.
The .js patch sets the default to 0 and fixes how the setting is referenced. ie,
settings.verticalPadding
should beconfig.params.verticalPadding
.Note: This doesn't fix the above problem, there's still 5px extra on the list item. If you set the height of
<div class="views-field-field-banner-image-fid">
to the exact height required in the stylesheet, which isn't ideal, then it works fine. I have no idea where the extra 5px comes from, it doesn't seem to be set with javascript or in the stylesheets.I suspect the browser generates it somehow. It's 5px on Firefox and 3px on IE7.
Comment #5
imclean CreditAttribution: imclean commentedForgot to add the default to $options. Here it is again.
Comment #6
imclean CreditAttribution: imclean commentedLast one for now. This is a combination of my previous patch and an altered version of this one: http://drupal.org/node/551866
I've put the settings, somewhat confusingly, in the "Transition" section of the views_cycle settings form because the only way I could get them to work was stick them in the js parameters. Unless I've misread it, it seems these are tied to the "params" fieldset.
Comment #7
Crell CreditAttribution: Crell commentedThe patch in #6 didn't apply, and didn't quite work right either. I've committed a modified and cleaned up version that also works around Javascript's moronic double-meaning of +. :-) Thanks all!
Comment #9
imclean CreditAttribution: imclean commentedThis issue still doesn't appear to be resolved. I'm using a fresh install of beta4 with the exact height entered in the settings, no padding. The problem seems to be these settings aren't being written to the page. Here is the generated javascript at the bottom of the page:
In fact, none of the config settings outside the js params are being used. Even the defaults (0 height, 5 padding) don't appear, although when I enter values they are saved correctly.
I am not using thumbnails. Looking in views_cycle_theme.in, it seems the relevant config options are only output when thumbnails are being used. To fix this, I replaced this:
With this:
Can you see any problems with this approach?
Comment #10
imclean CreditAttribution: imclean commentedWould it help to explain the above? I've simply moved the $settings assignments outside
if ($options['thumbnail_field']) { }
as they don't require thumbnails.I've also cast $options['height'] and $settings['verticalPadding'] as integers because they were being treated as strings by javascript.
Here's a patch.
Comment #11
Crell CreditAttribution: Crell commentedThe pager-related settings are only relevant if thumbnails are in use. height and verticalPadding, though, you're right should not be pager-dependent. I've made that change. Thanks!