Need help with developing a function

Hi all,

I’m posting this in the JS section even though my question does include CSS and AS because it is a JS function that I need to create. I’m 90% of the way to solving it but I’m real stuck now.

The effect I’m after is a full screen toggle button that can also turn the scrollbars “on and off”.

I’ve put together a JavaScript function that toggles fullscreen to normal view and visa versa as follows:


function fullScreenTog(){
 if (this.name =='fullScreen')
 JavaScript:window.close(self)
 else
 window.open(location.href,'fullScreen','fullscreen') 
}

I have the Flash Player call this function with this ActionScript:


fullScreenBtn.onRelease = function() {
	getURL("javascript: fullScreenTog()");
};

All good so far. :slight_smile:

Now, following is where I am banging my head against the wall.

The CSS I use to create the “no scrollbar” effect is this:


body 
{ 
overflow:hidden; 
}

However, I can’t work out how to have this CSS code execute only when I toggle with my button into full screen mode. I also want the scrollbar to come back after toggleing back to the normal screen size. (I have centred my flash movie within a table with the html center tag and use the above CSS to get a totally fullscreen with nothing else but a perfectly centred Flash movie.)

How would I develop the fullScreenTog() function so that when called it not only toggles from normal view to fullscreen view but it toggles the scrollbars “on and off” by somehow calling the above CSS with an if condition and else statement? I just can’t see a way of doing it.

Thank you in advanced to anyone that can help me out with this.

Try changing

overflow:hidden
to
overflow:auto

This should detect whether your content is beyond the boundaries, and if so, it displays the scrollbar, but if not, then it doesn’t.

Thank you so much!!!:beam: :beam: :beam:

I’ve been trying to work this out way till 5am this morning from 11pm the previous night. I posted elsewhere and the answers were if… else and so on ideas for a function. When all I needed was to change my css to:

overflow:auto

this hit it on the nose.

I’ve got to get into css more. That was the exact effect I was looking for lost.

I only stumbled accross the

overflow:hidden;

and it did the job I wanted at first but you know the rest…

Now I can get back to the design part of things again. The left part of my brain is going to sleep, I hope for now. I thought getting into web-design would be a lot simpler. Now I’m swimming in over 5 different languages and over 5 different softwhere applications. :hangover: (-: lol I hope I get to where I want to.

CSS is actually very easy to learn. I became quite knowledgable in CSS in about a week. There really isn’t much to it. I highly recommend learning it if you work in HTML, it will make your job easier :slight_smile:

Hey lost,

Where would you say the best place to learn ccs on the net is? Got any links?

I was on a site the other day Guardian Unlimited and this cool thing happened. Get this, a swf file was playing in a floating, small curved thing. I mean there was no boarders or anything just this movie playing a cartoonistic AD. I hate ADs and espescially pop ups but this was different. What got me the most was the shape. I’ve seen boxes hover over the page and stop and stuff and I believe that it is done with dhtml. Never seen anything like this though. I went through their source code with a tooth pick and checked all the files they were linking other code to and nothing. No embedded flash movie. I would love to know or get pointed in the right direction as to how these floating “objects” are done.

Also am I right in saying that dhtml is a blend of css and javascript? On your site, where you have text slide in and out behind what seems to be a usual frame, with there own scroll bars and so on, interests me also. Is the dhtml?

Would you spare me you best link to learning this?

Cheers :rambo:

DHTML is a blend of CSS and Javascript. But DHTML is harder than it sounds…lol.

The Flash overlay on sites only works in IE on Windows I believe. So I don’t recommend doing it, ever…lol. It uses Javascript to detect the browser, then if it is IE it displays the movie. The script probably isn’t inside the page, rather in an external .js file.

I can’t stand those ads.

As for CSS tutorials. I am self taught in CSS, but I ran a quick search on google, these seem to be pretty good.

http://www.htmlgoodies.com/beyond/css.html


http://www.graphixland.com/tips/css.shtml

If you need more, just run a search on google.com for “CSS Tutorials” Also try www.webmonkey.com , they a pretty good.

And finally, as for my site, that is DHTML, and Iframes.

btw my favourites are stuff packed with links on css, having a google is the first thing I do when I get on the computer. Thing is, even though my favs are categrised real good, I have a css folder overflowing with links in my Web-dev folder untouched.

Just needed your experience of where to start first. I think I’ll give good old htmlgoodies a bell. That’s where I started learning javascript. Very clear, step by step process. I never noticed there was a css section!

Thanks :slight_smile:

My Start was the CSS Reference in Dreamweaver, It is also how I learned Javascript as well. I have been to html goodies, they seem pretty good.