Foros de discusión

Problem with Carousel

thumbnail
Leon Dai, modificado hace 9 años.

Problem with Carousel

New Member Mensajes: 18 Fecha de incorporación: 28/06/07 Mensajes recientes
Hi all, I got a problem when using carousel and other modules. I found that the scripts after the carousel render method will be ignored. For example, take a look at following code snippet. Can anyone give me some advice?

JS:
YUI().use(
  'aui-button', 'aui-carousel',
  function(Y) {
    new Y.Carousel(
      {
        contentBox: '#myCarousel',
        height: 250,
        width: 700
      }
    ).render();
      
    new Y.Button(
      {
        icon: 'icon-print',
        iconAlign: 'left',
        label: 'Basic',
        srcNode: '#myButton'
      }
    ).render();
  }
);


HTML:
<div id="myCarousel">
  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/1.jpg);"></div>
  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/2.jpg);"></div>
  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/3.jpg);"></div>
  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/4.jpg);"></div>
</div>
<div>
  <button id="myButton"></button>
</div>
thumbnail
Byrån Zaugg, modificado hace 9 años.

RE: Problem with Carousel

Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
I'm guessing that there's a JS error somewhere, and that the JS has stopped processing. There may or may not be an error written to the browser console.

If you take out .render() (leave the rest) does Button work?
thumbnail
Leon Dai, modificado hace 9 años.

RE: Problem with Carousel

New Member Mensajes: 18 Fecha de incorporación: 28/06/07 Mensajes recientes
Byrån Zaugg:
I'm guessing that there's a JS error somewhere, and that the JS has stopped processing. There may or may not be an error written to the browser console.

If you take out .render() (leave the rest) does Button work?



yes, the button works if I take out the carousel render method or I change the order (button first then carousel).
thumbnail
Byrån Zaugg, modificado hace 9 años.

RE: Problem with Carousel

Expert Mensajes: 252 Fecha de incorporación: 6/04/12 Mensajes recientes
Any console errors?

AUI (or Portal) version are you running?
thumbnail
Leon Dai, modificado hace 9 años.

RE: Problem with Carousel

New Member Mensajes: 18 Fecha de incorporación: 28/06/07 Mensajes recientes
It works now though I have not changed anything in the code.
Thank you Byrån.