[ 3 posts ]

Green Wang

  • Username: Q.Wang
  • Joined: Sat Jan 16, 2010 6:30 pm
  • Posts: 44
  • Location: Beijing
  • Twitter: cocowool
  • GitHub: cocowool
  • Gists: cocowool
  • Offline
  • Profile

style conflick and multi instance

Post Posted: Fri Jul 23, 2010 2:42 am
+0-
i use alloyui calendar in my project
but i when the calendar load it's style, my whole page became a mess, this is the first problem
secondly, i use yui delegate to listen the special content area, and when user click the specific input field
the calendar render and show, but when click twice, it create a calendar again

how to solve these two problems, thanks
YUI, Why not Use In your project?

Nate Cavanaugh

YUI Contributor

  • Offline
  • Profile

Re: style conflick and multi instance

Post Posted: Wed Aug 18, 2010 7:37 am
+0-
Hi there,
Thanks for using the widget!
Number 1 is probably related to the fact that the module has a full CSS framework, including a reset.css.
You can however tell the YUI object to load the CSS before your stylesheet.
So let's say your stylesheet is:
Code:
<link href="main.css" rel="stylesheet" type="text/css" />

You can give that link an id like "myStyleSheet":
Code:
<link id="myStyleSheet" href="main.css" rel="stylesheet" type="text/css" />

Then, when you call YUI(), you would pass in the config option "insertBefore" like so:
Code:
YUI({
insertBefore: "myStyleSheet"
}).use()


And that should load up the CSS before your stylesheet.

As for the second problem, the best way to handle this would be to create the widget outside of the delegate function, and then inside of the delegate function, you can call .render().show(), like so:

Code:
var calendar = new Y.Calendar({...});

Y.delegate('click', function(){
calendar.render().show();
}, 'input');

And that should work. But without seeing your code, it's hard to say for sure the set up you have.

I hope that helps!
Nate Cavanaugh

Eduardo Lundgren

YUI Contributor

  • YUI Developer
  • Offline
  • Profile
Tags:

Re: style conflick and multi instance

Post Posted: Wed Aug 18, 2010 10:27 am
+0-
The Calendar constructor has an option called trigger, which handle the bind for you.

var calendar1 = new A.Calendar({
trigger: '#input1',
....
})
.render();
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum