Right. This is getting a bit complex. Judging by your code things
should be going well, could you put up a test page?

the global vars suggestion was a shot in the dark, if you a run loop
they will be overwritten for every iteration unless the assignment
doesn't execute.

On Nov 14, 2:23 pm, CodingCyborg <[EMAIL PROTECTED]> wrote:
> I have confirmed that when one of a group of windows is clicked, it
> runs as if every window in that group was clicked at the same time and
> runs the code for each of them.
>
> This causes quite an awkward outcome, but I have no idea why its
> happening, nor how to stop it.
>
> On Nov 14, 9:03 am, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> > I haven't looked througly at your code, but I see you're using global
> > variables, that might be an issue:
>
> > $('.draggableWindow').mousedown(function(){
> >                 var numWindows=$('.draggableWindow').length + 500;
> >                 var zindexIt2 = parseInt($(this).css("z-index"));
> >                 if(zindexIt2 < numWindows){
> >                         $(this).css("z-index",numWindows);
> >                         $('.draggableWindow').each(function(){
> >                             var newZ2=$(this).css("z-index");
> >                             if(newZ2 > zindexIt2){ //being greater
> > doesn't mean it's only 1 unit greater
> >                                 newZ2 = zindexlt2-2; //just to be safe
> >                                 $(this).css("z-index",newZ2);
> >                                 $(this).children('h1').text(parseInt($
> > (this).css("z-index")));
> >                             }
> >                         });
> >                 }
> >         });
>
> > On Nov 14, 11:13 am, CodingCyborg <[EMAIL PROTECTED]> wrote:
>
> > >         jQuery('.draggableWindow').mousedown(function(){
> > >                 numWindows=jQuery('.draggableWindow').size() + 500;
> > >                 zindexIt2 = parseInt($(this).css("z-index"));
> > >                 if(zindexIt2 < numWindows){
> > >                         $(this).css("z-index",numWindows);
> > >                         $('.draggableWindow').each(function(){
> > >                             newZ2=$(this).css("z-index");
> > >                             if(newZ2 > zindexIt2){
> > >                                 newZ2--;
> > >                                 $(this).css("z-index",newZ2);
> > >                                 
> > > $(this).children('h1').text(parseInt($(this).css("z-index")));
> > >                             }
> > >                         });
> > >                 }
> > >         });
>
> > > I added a line so I could watch the z-index movements of the draggable
> > > windows. I found that they are all on separate layers but for some
> > > reason instead of each of them above the one you bring to front
> > > dropping one, some will drop two while others don't move. I'm not sure
> > > why this is happening, it's almost as if some windows are run through
> > > the .each() multiple times while others don't move. Or when others go
> > > through it they affect the first one through it.
>
> > > Help would be highly appreciated!
>
> > > On Nov 13, 1:08 pm, CodingCyborg <[EMAIL PROTECTED]> wrote:
>
> > > > I recently have been playing around with a "Desktop" module that was
> > > > on nettuts and made a modification for it that doesn't fully work.
> > > > There are many draggable windows, and in order for them to function
> > > > like a real desktop they need to have z-index changes such that if you
> > > > close one on top the last one you had on top is right below it.
>
> > > > I believe my error comes in with "this" or possibly something else,
> > > > but when you pull one to the front it causes some or all of the others
> > > > to end up in the same z-index causing them to not stay in order of
> > > > recently viewed.
>
> > > >         jQuery('.draggableWindow').mousedown(function(){
> > > >                 numWindows=jQuery('.draggableWindow').size() + 
> > > > 500;//the + 500 is to
> > > > make sure they are above other objects on the page
> > > >                 zindexIt2 = parseInt($(this).css("z-index"));
> > > >                 if(zindexIt2 < numWindows){
> > > >                         $(this).css("z-index",numWindows);//brings to 
> > > > front
> > > >                         
> > > > $('.draggableWindow').each(function(){//supposed to drop others
> > > > back one...
> > > >                         newZ2=$(this).css("z-index");
> > > >                         if(newZ2 > zindexIt2){
> > > >                                 newZ2--;
> > > >                                 $(this).css("z-index",newZ2);
> > > >                         }
> > > >                         });
> > > >                 }
> > > >         });

Reply via email to