Closed Thread Icon

Topic awaiting preservation: moderately intelligent person+ needed to help me sort out a dumb problem Pages that link to <a href="https://ozoneasylum.com/backlink?for=9000" title="Pages that link to Topic awaiting preservation: moderately intelligent person+ needed to help me sort out a dumb problem" rel="nofollow" >Topic awaiting preservation: moderately intelligent person+ needed to help me sort out a dumb problem\

 
Author Thread
smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 01-22-2004 15:46

Hi guys,

Me again, let's see if Yossi will come to the rescue this time too

Ok well my problem this time should be a simple one, basically I have a project I'm working on as a minor part of a larger project for university.

This project features a simple 'sliding panel' type interface, I have this working using my own script for 'shrinking' elements (Rod Morelos did a lot of the ground work). This is not a problem. The problem is calling the panel 'open / close' functions at the correct time and the correct number of times.

The functionality should work like this:

onclick, the panel will call the 'open function' if it is closed or if there is another panel infront of it

onclick, the panel will only call the 'close function' if it is open and the current 'frontmost/viewable' panel

onclick, the panel will open or close all the other panels in accordance with basic sliding panel functionality


The current issue is that panels will open as expected, and when an open panel is clicked on it will close the other panels blocking it from being the 'current viewable panel', all is good - but then if that panel is clicked a second time it should close itself also but it doesn't.

I've been trying to fix it, but can't figure it out, I have set up a demo and a 'debug demo' that shows alerts to indicate what function is getting called and when (helps illustreate the problems).
http://www.cryokinesis.co.uk/baltic/index.htm
http://www.cryokinesis.co.uk/baltic/indexdebug.htm


Thanks guys,

Jon

P.S. whilst the code is all xhtml transitional compliant and nothing unordinary for some reason my friend couldn't see anything in firebird. I however can see everything fine in my firebird and opera 7 and ie 6, so I don't know if there is a problem or not, but if you notice it not woking then please let me know.

<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 01-22-2004 16:22

smonkey: The following function seems to work like you want

code:
handler:function(id)
{
for( i=1; i<=4; i++ )
{
if( i<id )
shrink.open( i )
else if( i>id )
shrink.close( i )
else
{
if( shrink.flag[i] )
shrink.close( i )
else
shrink.open( i )
}
}
}

Hope that helps

[edit] Neat design, and the page works for me with FB0.7, but for an unknown reason it's blank in MZ1.6 [/edit]



[This message has been edited by poi (edited 01-22-2004).]

Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 01-22-2004 16:29

that's cool...neat idea!

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 01-22-2004 17:45

Thanks Poi, it is working well but I was specifically after a slight difference to how you have it - basically imagine that every panel you click then becomes the one 'on show' unless it was already 'on show' in which case it closes instead.

Does that make sense, the way you have it is that if i click an open panel it closes and if I click a closed panel it opens.

Also if you uncomment the alerts on the open and close functions you'll see that your code makes a lot of unnecessary function calls - now I don't see any performance problems and if it is the only way then I don't mind, but my secret inner-coder keeps niggling away saying there must be a simpler more efficient way. But as I said, if this is the easiest or only way then it is ok.

Thanks again Poi, you make some good stuff and I respect your wisdom - any good 'new' stuff on the go I can peek at?

[**EDIT**] Does anyone have any idea why Moz 1.6 only displays a blank page? a new bug? a new very strict w3c recomendation implemented?

<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 01-22-2004 19:22

smonkey: Sorry Let's say that I hacked your script in a hurry and that I don't sleep enough.


Try the following function instead ( BTW, it no longer have the unnecessary calls to open() and close() )<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>handler:function( id )
{
for( i=1; i<=4; i++ )
{
if( i==id )
{
if( ( i==4 && shrink.flag[id] )

Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 01-22-2004 20:23

smonkey: Sorry for not answering I wasn't connected...

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 01-22-2004 21:06

Poi, you are my new hero ( take a walk yossi )

It works great (after I noticed your syntax error in the 'or' thing (

Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 01-22-2004 21:08

Just a thought ...

code:
<HTML>
<SCRIPT type=text/javascript>
var maxCellWidth = 0;
function fixSize(cell){
var allCells = cell.parentNode.cells;
if(maxCellWidth==0)
maxCellWidth = allCells[allCells.length -1].offsetWidth + "px";

for(var i=0;i<(allCells.length -1); i++)
if(allCells[i]!=cell)
allCells[i].style.width = "15px";

cell.style.width = maxCellWidth;
}
</SCRIPT>
<BODY>
<TABLE style="width:100%; height:30%" cellspacing=0 cellpading=0>
<TR>
<TD style="BACKGROUND: #bc4b4b; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD style="BACKGROUND: #29775b; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD style="BACKGROUND: #9e6e42; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD style="BACKGROUND: #ecdc8f; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD style="BACKGROUND: black; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD style="BACKGROUND: blue; width:15px" onClick="fixSize(this)">&nbsp;</TD>
<TD>&nbsp;</TD>
</TR>
</TABLE>
</BODY>
</HTML>



smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 01-22-2004 21:22

Hey Yossi - better late than never

Ok, well apart from it using tables (I am one of the those 'new found born again table haters') it works really well, it also suffers from the not closing itself issue that poi's script had first time too.

I do like it tho, very impressive for a small bit of code, but where's my gimmicky sliding action?

Hey Poi, trinerarrererrery operators - gotta love em, ugly as hell tho:<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
handler:function( id )
{
for( i=1; i<=4; i++ )
{
i==id?(i==4&&shrink.flag[id])

« BackwardsOnwards »

Show Forum Drop Down Menu