[scriptaculous] Why my sliders disapear ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[scriptaculous] Why my sliders disapear ?

cedreek
Hi,

see here: http://www.squeakside.com/seaside/NARS/test/truthval.

If I click on a (non ajax) link, then the slider dissapear... like if no css...

Any ideas ?

Thanks

Cédrick

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Gerhard Obermann
Hi!
 
It was a little bit hard to read your code.
But i am sure i found the problem!
 
You are always increasing your sliderId.
So after a page refresh you dont have your old Id's like tack1,....7.
of course the same thing happens with your handles.
And all your CSS settings are gone.
To get an unique id you could use "hmtl nextId"
So maybe its better to use an unique css class for all your div#track[id] and handles.
 
 
I would also suggest to use html evaluator instead of 2 html updater.
Because then you have only 1 AJAX call instead of 2.
 
br
Gerhard


 
On Sun, Jul 27, 2008 at 5:53 PM, cdrick <[hidden email]> wrote:
Hi,

see here: http://www.squeakside.com/seaside/NARS/test/truthval.

If I click on a (non ajax) link, then the slider dissapear... like if no css...

Any ideas ?

Thanks

Cédrick

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

cedreek
> Hi!
>
> It was a little bit hard to read your code.

oops, I was doing penty of experiments ;)

> But i am sure i found the problem!

cool :)
>
> You are always increasing your sliderId.
> So after a page refresh you dont have your old Id's like tack1,....7.

oh that's true !

> of course the same thing happens with your handles.
> And all your CSS settings are gone.
> To get an unique id you could use "hmtl nextId"
> So maybe its better to use an unique css class for all your div#track[id]
> and handles.

Thanks for the the css too...  but do I put directly div#track[id] in
the css file ?

>
>
> I would also suggest to use html evaluator instead of 2 html updater.
> Because then you have only 1 AJAX call instead of 2.
>

Thanks a lot Gerhard ;)
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Gerhard Obermann
> Thanks for the the css too...  but do I put directly div#track[id] in
> the css file ?
 
You could use a css class for all such div like e.g. div.handle instead of directly referencing the Ids.
 
 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Lukas Renggli
> > Thanks for the the css too...  but do I put directly div#track[id] in
> > the css file ?
>
> You could use a css class for all such div like e.g. div.handle instead of
> directly referencing the Ids.

Yeah, generally it is better to use CSS classes for styling and use
ids for JavaScript programming only. Otherwise you run into
unnecessary complications.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

cedreek
2008/7/27 Lukas Renggli <[hidden email]>:

>> > Thanks for the the css too...  but do I put directly div#track[id] in
>> > the css file ?
>>
>> You could use a css class for all such div like e.g. div.handle instead of
>> directly referencing the Ids.
>
> Yeah, generally it is better to use CSS classes for styling and use
> ids for JavaScript programming only. Otherwise you run into
> unnecessary complications.
>
There's something I have not understood. I agree on what you say, but
how to separate css from javascript in the case of slider as the track
and the handle are css div's.
I've tried using a class instead of an id but if I remember well I had
only one slider aworking and not the others. Maybe I did it wrong, is
it what your suggest ? Actually, I "reused" the scriptaculous example,
using id  handle1 handle2, ....

I have another question, CSS related, when you have such succession of
div's or whatever (div#name1 div#name2, ...). Is it possible to
declare in one line (in the CSS file)

div#name[] {
}

Thanks,

Cédrick



> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Lukas Renggli
>  I have another question, CSS related, when you have such succession of
>  div's or whatever (div#name1 div#name2, ...). Is it possible to
>  declare in one line (in the CSS file)
>
>  div#name[] {
>  }

Yes, you can write:

     div#name1, div#name2 { }

Note that your use of [] is confusing, because there is a similar
construct part of CSS 2.0. I know that you are using it here as a
placeholder for a number.

But again, I suggest not to use IDs for styling. Only use CSS classes
for styling, even if the particular style is only used once.

     .handle { }
     .slider { }

and the html

     html div id: 'slider1'; class: 'slider'; with: [ html div class: 'handle' ]
     html div id: 'slider2'; class: 'slider'; with: [ html div class: 'handle' ]

Like this the IDs you use for the JavaScript don't affect the layout.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

cedreek
Ok thanks for the clarification Lukas ;)

In scriptaculous example, the style is defined on id's. Do you think
it should be also in a class ?



2008/7/28 Lukas Renggli <[hidden email]>:

>>  I have another question, CSS related, when you have such succession of
>>  div's or whatever (div#name1 div#name2, ...). Is it possible to
>>  declare in one line (in the CSS file)
>>
>>  div#name[] {
>>  }
>
> Yes, you can write:
>
>     div#name1, div#name2 { }
>
> Note that your use of [] is confusing, because there is a similar
> construct part of CSS 2.0. I know that you are using it here as a
> placeholder for a number.
>
> But again, I suggest not to use IDs for styling. Only use CSS classes
> for styling, even if the particular style is only used once.
>
>     .handle { }
>     .slider { }
>
> and the html
>
>     html div id: 'slider1'; class: 'slider'; with: [ html div class: 'handle' ]
>     html div id: 'slider2'; class: 'slider'; with: [ html div class: 'handle' ]
>
> Like this the IDs you use for the JavaScript don't affect the layout.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Lukas Renggli
>  In scriptaculous example, the style is defined on id's. Do you think
>  it should be also in a class ?

Yes, I stopped to use IDs for styling altogether (there might be
exceptions of course). Using IDs for styling leads to problems sooner
or later. I think the examples in Scriptaculous should be adapted.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Lukas Renggli
I've submitted a task:

    http://code.google.com/p/seaside/issues/detail?id=109

On 7/28/08, Lukas Renggli <[hidden email]> wrote:

> >  In scriptaculous example, the style is defined on id's. Do you think
>  >  it should be also in a class ?
>
>
> Yes, I stopped to use IDs for styling altogether (there might be
>  exceptions of course). Using IDs for styling leads to problems sooner
>  or later. I think the examples in Scriptaculous should be adapted.
>
>
>  Cheers,
>  Lukas
>
>  --
>  Lukas Renggli
>  http://www.lukas-renggli.ch
>


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: [scriptaculous] Why my sliders disapear ?

Steve Aldred-3
In reply to this post by cedreek
cdrick wrote:
> Ok thanks for the clarification Lukas ;)
>
> In scriptaculous example, the style is defined on id's. Do you think
> it should be also in a class ?

The autocomplete example was using styles on ids. It is a good example
as to why you generally shouldn't do it. The way the code was written
you would get two objects with the same id. If you look at that with
Firebug you only see one object - that's because by definition ids are
supposed to be unique across a document.

There are occasions when styling ids is useful but the majority of
styling applies to all instances/occurences  of a thing. Id styling is
normally to highlight 'this' particular instance is different.

hth
Steve
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside