Forums de discussion

Problem with Carousel

thumbnail
Leon Dai, modifié il y a 9 années.

Problem with Carousel

New Member Publications: 18 Date d'inscription: 28/06/07 Publications récentes
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, modifié il y a 9 années.

RE: Problem with Carousel

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
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, modifié il y a 9 années.

RE: Problem with Carousel

New Member Publications: 18 Date d'inscription: 28/06/07 Publications récentes
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, modifié il y a 9 années.

RE: Problem with Carousel

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
Any console errors?

AUI (or Portal) version are you running?
thumbnail
Leon Dai, modifié il y a 9 années.

RE: Problem with Carousel

New Member Publications: 18 Date d'inscription: 28/06/07 Publications récentes
It works now though I have not changed anything in the code.
Thank you Byrån.