I am working on some code that is currently in javascript that I would
like to be able to do in CSS if possible and 100% eliminate JS. At the
URL http://www.aerosmithfans.com/index2.html there is a series of 4 CD
cover images with a scroll button on each side. When the user clicks
the button, the selection of the four CD covers changes. Is there a way
to code this so that it is purely CSS and no JS what-so-ever? If so can
someone please point me to a site that describes what I need? Thanks
because right not this -> http://www.pczero.net/hello.html <- is how I
am feeling!
Change PH to F... wrote:
> I am working on some code that is currently in javascript that I would
> like to be able to do in CSS if possible and 100% eliminate JS. At the
> URL http://www.aerosmithfans.com/index2.html there is a series of 4 CD
> cover images with a scroll button on each side. When the user clicks
> the button, the selection of the four CD covers changes. Is there a way
> to code this so that it is purely CSS and no JS what-so-ever? If so can
> someone please point me to a site that describes what I need? Thanks
> because right not this -> http://www.pczero.net/hello.html <- is how I
> am feeling!
>
Maybe a CSS guru can do the job, but it may be useful to describe the
issue you are trying to overcome - CSS may not be the solution.
Depending on your reasons, it might also help to post in
comp.lang.javascript. Most of the code in the page can be significantly
reduced - for example, the 50-odd lines of 'CacheCDCovers()' can be
replaced with:
var imagemain=[];
function CacheCDCovers2()
{
var i=0;
while ( i<25 ){
imagemain[i] = new Image();
imagemain[i].src = 'imgs/cd' + (++i) + '.jpg';
}
}
Browser sniffing such as:
if (parseInt(navigator.appVersion)>=3) {
is completely unnecessary (and quite useless - Firefox 1.0.6 reports as
5.0).
The scroll left/right function can be achieved in about 10 lines (or
less). The page can remain fully functional if scripting is unavailable.
--
Rob
In article <kdtXe.522$uQ6.26270@news.optus.net.au>, rgqld@iinet.net.au
says...
> Change PH to F... wrote:
>
> Maybe a CSS guru can do the job, but it may be useful to describe the
> issue you are trying to overcome - CSS may not be the solution.
>
> Depending on your reasons, it might also help to post in
> comp.lang.javascript. Most of the code in the page can be significantly
> reduced - for example, the 50-odd lines of 'CacheCDCovers()' can be
> replaced with:
>
> var imagemain=[];
>
> function CacheCDCovers2()
> {
> var i=0;
> while ( i<25 ){
> imagemain[i] = new Image();
> imagemain[i].src = 'imgs/cd' + (++i) + '.jpg';
> }
> }
>
>
> Browser sniffing such as:
>
> if (parseInt(navigator.appVersion)>=3) {
>
> is completely unnecessary (and quite useless - Firefox 1.0.6 reports as
> 5.0).
>
> The scroll left/right function can be achieved in about 10 lines (or
> less). The page can remain fully functional if scripting is unavailable.
>
>
>
Thanks for pointing out the shorthand on the caching code. I had used
that from another site I run where the pic names are not even close to
similar and thus the shirt hand was not quite as clean.
I basically wanted to eliminate the javascript as much as possible so
that even guests to the site who use a browser w/o javascript would be
able to have the full functionality of the CD covers scrolling. I was
thinking (maybe incorrectly) that trying to do this with CSS would be
a way to accomplish that task.
Thanks...
Change PH to F... wrote:
> I am working on some code that is currently in javascript that I would
> like to be able to do in CSS if possible and 100% eliminate JS.
I think you miss the point of CSS, and to answer your question: no CSS
can not eliminate Javascript. What you are doing is a perfectly
reasonable use of Javascript. CSS can not do that nor should it.
In article <1127123819.499485.291930@g47g2000cwa.googlegroups.com>,
logicearth@XXXXXXXXXX says...
> Change PH to F... wrote:
>
> I think you miss the point of CSS, and to answer your question: no CSS
> can not eliminate Javascript. What you are doing is a perfectly
> reasonable use of Javascript. CSS can not do that nor should it.
>
>
OK thanks. I was informed that what I was doing was able to be
replicated in CSS. I couldnt figure out how to do it and maybe now I
know why!
:)