![]()
partendo da questo esempio:
http://davidwalsh.name/dw-content/kwicks.php
Ho modificato il tutto per averlo in verticale:
il mio problema è che all'evento mouseleave non viene ripristinato lo stato inizialecodice:<script type="text/javascript"> var Kwicks = new Class({ Implements: [Options], options: { squeezeHeight: 60, maxHeight: 176 }, initialize: function(list,options) { this.setOptions(options); this.list = document.id(list); this.parse(); }, parse: function() { //vars var items = this.list.getElements('a'), fx = new Fx.Elements(items, {wait: false, duration: 350, transition:Fx.Transitions.Cubic.easeOut}), startHeights = [], options = this.options; //kwicks items items.each(function(item,i) { startHeights.push(item.getStyle('height').toInt()); item.addEvent('mouseenter',function(){ var fxSettings = {}; fxSettings[i] = { 'height': [item.getStyle('height').toInt(),options.maxHeight] }; items.each(function(sibling,ii) { if(sibling != item) { var h = sibling.getStyle('height').toInt(); if (h != options.squeezeHeight) { fxSettings[ii] = { 'height': [h,options.squeezeHeight] }; } } },this); fx.start(fxSettings); },this); },this); //list this.list.addEvent('mouseleave',function() { var fxSettings = {}; items.each(function(item,i) { fxSettings[i] = { height: [item.getStyle('height').toInt(), squeezeHeight[i]] }; }); fx.start(fxSettings); }); } }); window.addEvent('domready',function() { var kwicks = new Kwicks('kwicks'); }); </script>.
Ho provato a vedere le l'evento mouseleave viene richiamato mettendo un alert('test') ed effettivamente l'alert appare quando esco con il puntatore...
La parte di codice che dovrebbe far chiudere la "fisarmonica" è questo:
dove sbaglio?codice://list this.list.addEvent('mouseleave',function() { alert('test'); var fxSettings = {}; items.each(function(item,i) { fxSettings[i] = { height: [item.getStyle('height').toInt(), squeezeHeight[i]] };

.
Rispondi quotando
