Forum

Accueil » Alloy UI » English

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Leon Dai
Problem with Carousel
13 août 2014 09:37
Réponse

Leon Dai

Rang: New Member

Publications: 18

Date d'inscription: 28 juin 2007

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:
 1YUI().use(
 2  'aui-button', 'aui-carousel',
 3  function(Y) {
 4    new Y.Carousel(
 5      {
 6        contentBox: '#myCarousel',
 7        height: 250,
 8        width: 700
 9      }
10    ).render();
11      
12    new Y.Button(
13      {
14        icon: 'icon-print',
15        iconAlign: 'left',
16        label: 'Basic',
17        srcNode: '#myButton'
18      }
19    ).render();
20  }
21);


HTML:
 1<div id="myCarousel">
 2  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/1.jpg);"></div>
 3  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/2.jpg);"></div>
 4  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/3.jpg);"></div>
 5  <div class="carousel-item" style="background: url(http://alloyui.com/carousel/img/4.jpg);"></div>
 6</div>
 7<div>
 8  <button id="myButton"></button>
 9</div>
Byrån Zaugg
RE: Problem with Carousel
13 août 2014 15:38
Réponse

Byrån Zaugg

LIFERAY STAFF

Rang: Regular Member

Publications: 143

Date d'inscription: 5 avril 2012

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?
Leon Dai
RE: Problem with Carousel
13 août 2014 20:29
Réponse

Leon Dai

Rang: New Member

Publications: 18

Date d'inscription: 28 juin 2007

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).
Byrån Zaugg
RE: Problem with Carousel
14 août 2014 10:47
Réponse

Byrån Zaugg

LIFERAY STAFF

Rang: Regular Member

Publications: 143

Date d'inscription: 5 avril 2012

Publications Récentes

Any console errors?

AUI (or Portal) version are you running?
Leon Dai
RE: Problem with Carousel
14 août 2014 20:37
Réponse

Leon Dai

Rang: New Member

Publications: 18

Date d'inscription: 28 juin 2007

Publications Récentes

It works now though I have not changed anything in the code.
Thank you Byrån.