Is there a way to disable the buttons from being output in the carousel from Views? I want the carousel to scroll with no navigation buttons.

Comments

quicksketch’s picture

Honestly, the easiest approach is to add CSS to display: none the arrows. You can also add your own JS to disable the buttons, but that's significantly more heady than just hiding them.

quicksketch’s picture

Status: Active » Closed (fixed)
baby.hack’s picture

How would setting display:none in css solve this? Doesn't the element itself get it's display style property set in js as display:block, which would override any css applied to it's class? Or am I missing something?

In any case, wouldn't setting buttonNextHTML and buttonPrevHTML to NULL be the appropriate way to do this?

shanefjordan’s picture

Status: Closed (fixed) » Active

baby.hack is correct, this element receives a inline style of "display:block" that overrides the "display:none" property set in the stylesheet.

An option to just not display them in the jCarousel settings would be best. Any help?

Thanks,
Shane

shanefjordan’s picture

Alright, so as a interim solution, you can modify the css with:

.jcarousel-skin-default .jcarousel-next, 
.jcarousel-skin-default .jcarousel-prev {
        background-image:none;
        height: 0px;
        width: 0px;
}
baby.hack’s picture

What I ended up doing was modifying the module's style options to include the ability to disable the buttons. Then I used those options in the js.

Something like
jcarousel_style_plugin.inc:

class jcarousel_style_plugin extends views_plugin_style {
  function option_definition() {
    .
    .
    $options['buttonPrevHTML'] = array('default' => NULL);
    $options['buttonNextHTML'] = array('default' => NULL);
    .
    .
    return $options;
  }
  function options_form(&$form, &$form_state) {
    .
    .
    $form['buttonPrevHTML'] = array(
      '#type' => 'select',
      '#title' => t('PREV Button'),
      '#description' => t('Enable of disable the PREV button'),
      '#options' => array(
        0 => t('Enabled'),
        1 => t('Disabled'),
      ),
      '#default_value' => $this->options['buttonPrevHTML'],
    );
    $form['buttonNextHTML'] = array(
      '#type' => 'select',
      '#title' => t('NEXT button'),
      '#description' => t('Enable of disable the NEXT button'),
      '#options' => array(
        0 => t('Enabled'),
        1 => t('Disabled'),
      ),
      '#default_value' => $this->options['buttonNextHTML'],
    );
    .
    .
  }

jcarousel.js:

Drupal.behaviors.jcarousel = {};
Drupal.behaviors.jcarousel.attach = function(context, settings) {
  .
  .
  for (var key in settings.jcarousel.carousels) {
    .
    .
    // Change next and previous buttons to links for accessibility.
	if (!options.hasOwnProperty('buttonNextHTML') && options.buttonNextHTML != 1){
      options.buttonNextHTML = '<a href="javascript:void(0)"></a>';
	}else if(options.buttonNextHTML == 1){
		options.buttonNextHTML = null;
	}
    if (!options.hasOwnProperty('buttonPrevHTML') && options.buttonPrevHTML != 1){
      options.buttonPrevHTML = '<a href="javascript:void(0)"></a>';
	}else if(options.buttonPrevHTML == 1){
		options.buttonPrevHTML = null;
	}

    // Initialize the jcarousel.
    $carousel.addClass('jcarousel-processed').jcarousel(options);
  }
  .
  .
};

This was for the 7.x-2.4-alpha3 version. Not sure what the dif is with the 6.x versions.

Everett Zufelt’s picture

In 7.x, instead of removing, try setting the class to "element-invisible element-focusable". This 'should' make the < and > show up only on focus, and keep them available to screen-reader and keyboard only users. Some more accessibility fixes are likely needed, but I have never used this module.

Of course it is bad practice to hide controls that people might need, and people need the ability to control the flow of this content, as some people have disabilities that requires them to have more time with the content in front of them.

quicksketch’s picture

Status: Active » Fixed

I won't be adding this as a feature to jCarousel. The most common solution would be hiding the buttons with CSS, as @shane_jordan did in #5.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.