Buon pomeriggio.
Tramite YUI library sto cercando di costruire un sito sullo stile di iGoogle.
L'esempio di base riporta all'interno dei livelli dei feed mentre io avrei la necessità di inserisci del contenuto mio:
Vi posto il codice del Javascript:
Qui vengono create le variabili dei livelli.
codice:
YUI(yuiConfig).use('dd', 'anim', 'io', 'cookie', 'json', function(Y) {
//Make this an Event Target so we can bubble to it
var Portal = function() {
Portal.superclass.constructor.apply(this, arguments);
};
Portal.NAME = 'portal';
Y.extend(Portal, Y.Base);
//This is our new bubble target..
Y.Portal = new Portal();
//Setup some private variables..
var goingUp = false, lastY = 0, trans = {};
//The list of feeds that we are going to use
var feeds = {
'ynews': {
id: 'ynews',
title:'Yahoo! US News',
//url: 'rss.news.yahoo.com/rss/us',
article: 'Contenuti di Yahoo Us News'
},
'yui': {
id: 'yui',
title: 'YUI Blog',
//url: 'feeds.yuiblog.com/YahooUserInterfaceBlog',
article: 'Contenuti di YUI Blog'
},
'slashdot': {
id: 'slashdot',
title: 'Slashdot',
//url: 'rss.slashdot.org/Slashdot/slashdot',
article: 'Contenuti di Slashdot'
},
'ajaxian': {
id: 'ajaxian',
title: 'Ajaxian',
//url: 'feeds.feedburner.com/ajaxian',
article: 'Contenuti di Ajaxian'
},
'daringfireball': {
id: 'daringfireball',
title: 'Daring Fireball',
//url: 'daringfireball.net/index.xml',
article: 'Contenuti di Daring Fireball'
},
'wiredtech': {
id: 'wiredtech',
title: 'Wire: Tech Biz',
//url: 'www.wired.com/rss/techbiz.xml',
article: 'Contenuti di Wire: Tech Biz'
},
'techcrunch': {
id: 'techcrunch',
title: 'TechCrunch',
//url: 'feedproxy.google.com/Techcrunch',
article: 'Contenuti di TechCrinch'
},
'smashing': {
id: 'smashing',
title: 'Smashing Magazine',
//url: 'www.smashingmagazine.com/wp-rss.php',
article: 'Contenuti di Smashing Magazine'
}
};
Con questo codice invece vengono popolati.
codice:
on: {
success: function(id, data) {
//On success get the feed data
var d = feeds[trans[id]]
//Node reference
inner = d.mod.one('div.inner'),
//html = '<ul>[*]Feed failed to load..[/list]';
html = 'Prova' + feeds.title;
// Inizio popolazione livello
// Fine popolazione livello
//Set the innerHTML of the module
inner.set('innerHTML', '<ul>' + html + '[/list]');
if (Y.DD.DDM.activeDrag) {
//If we are still dragging, update the proxy element too..
var proxy_inner = Y.DD.DDM.activeDrag.get('dragNode').one('div.inner');
proxy_inner.set('innerHTML', '<ul>' + html + '[/list]');
}
},
failure: function(id, data) {
//Something failed..
var d = feeds[trans[id]],
//Node reference
inner = d.mod.one('div.inner'),
html = '<ul>[*]Feed failed to load..[/list]';
inner.set('innerHTML', html);
if (Y.DD.DDM.activeDrag) {
//If we are still dragging, update the proxy element too..
var proxy_inner = Y.DD.DDM.activeDrag.get('dragNode').one('div.inner');
proxy_inner.set('innerHTML', html);
}
}
}
});
//Keep track of the transaction
feeds[data.id].trans = id;
feeds[data.id].mod = mod;
trans[id.id] = data.id;
};
"inner" è il nome del livello che contiene i dati
Vorrei fare in modo che a seconda del livello trascinato mi mostri il suo contenuto.
Per ora sono solo riuscito ad inserire del codice HTML uguale per tutti.
Avete qualche suggerimento per cortesia?