[Pro] DIV to viewport

Dear friends, here another little thing I’m not getting to work unfortunately.

I need to resize the first (top) DIV to the viewport, which works. However, I can’t et the DIV to resize along with the window/viewport when resizing the window. Once the page is loaded, it doesn’t resize anymore. How can this be solved?

Here the fiddling : http://jsfiddle.net/rvanheukelum/sKaWz/

Any help is appreciated (as always) :slight_smile:

Regards, Richard

http://fiddle.jshell.net/rvanheukelum/sKaWz/4/show/


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

By the way … looking at ‘this code’ … this should be able to get actionized. Perhaps something for our friends at Softpress to look at?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The issue is that you’re calling the function only once – at page load – and never again thereafter. The value of $(window).height() is fixed at the moment you ask for it. It’s inside a closure, in technical terms, and only has access to the values that were true at the instant it was called.

If you were to wrap up your function as a named variable, and call it when the page loads, and again when the page resizes, then you would have the result you’re after.

But if you’re going to use the level of CSS you’re using here, why use jQuery or JavaScript at all? This is the same thing, and it’s always going to be the right size:

http://jsfiddle.net/UbCLJ/3/show/

fiddle here:

Walter

On Nov 28, 2013, at 11:11 AM, Richard van Heukelum wrote:

Dear friends, here another little thing I’m not getting to work unfortunately.

I need to resize the first (top) DIV to the viewport, which works. However, I can’t et the DIV to resize along with the window/viewport when resizing the window. Once the page is loaded, it doesn’t resize anymore. How can this be solved?

Here the fiddling : http://jsfiddle.net/rvanheukelum/sKaWz/

Any help is appreciated (as always) :slight_smile:

Regards, Richard

http://fiddle.jshell.net/rvanheukelum/sKaWz/4/show/


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is so great, wow

To be honest, I’ve been looking for ‘viewport to div’ in Google, and I ended up with tons of search results, mostly (if not all) js/jquery driven. Not knowing anything about this, I started there …

You totally got me by surprise solving it ‘simply’ with just CSS.

But … thanks for explaining what I did wrong, and how it ‘should’ work in stead of just passing me the code. This way I might just pick up something :wink:

Very thankful


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m sorry to bother you again about this …

… recreating Viewport to DIV - JSFiddle within FreewayPro gives me some trouble.

With just one DIV I manage to resize the #header div to the viewport, but as soon as I add additional DIV’s underneath it … they squize themselves to the right of #header.

http://fwdemo.rvanheukelum.com/viewport-to-div/right.html (just the div #header)

http://fwdemo.rvanheukelum.com/viewport-to-div/wrong.html (multiple div’s)

Richard


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I am not exactly sure what you are trying to achieve with the additional Divs but because they are all clear:both and the header has no float property then there is nothing to clear against. Not sure if that makes sense!

Anyway if you add the float property to the header you will also need to do something about the height - I think. Tricky without your file and intentions.

Or make it all inline?

David


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi David,

I want to achieve this : Viewport to DIV - JSFiddle

I just want to ‘open’ the page with a flexible DIV, being ‘the cover’ of this one-page site. That works for as long as I don’t add additional div’s underneath the first one. As soon as I do that the end up at the right. The demo above shows there’s no floating, either way it works as it should.

Within Freeway I only can do that for as long there is only 1 div as shown here :
http://fwdemo.rvanheukelum.com/viewport-to-div/right.html

As soon as I add additional div’s as in the jsfiddle example I end up with this:
http://fwdemo.rvanheukelum.com/viewport-to-div/wrong.html

Later on I want to add a static menu, where the menu-items link to the anchored div’s.

Does this make any sense?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Where did you get the attribute div { display:table } from?

That along with display: table-cell; on the header appear to be your problem.

D


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is this what you are trying to achieve.

http://www.deltadesign.co/FW6Test/richard.html

D


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Holy … I should have known the display:table-cell would brake down the page :S

Reason for the usage of display:table-cell simply was the advantage of vertically align text within the div (behaving as a table cell).

But this is exactly what I was trying to achieve indeed Dave, so many many thanks for your input on this!

Richard


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hey Richard…

I am also a little confused - I followed your example and set up this in
Freeway Pro using an inline layout -
http://cssway.thebigerns.com/workbench/richardvans-quest/

There are some pitfalls to avoid - I used a secondary div (FirstDiv) rather
than try to wrestle with the ubiquitous PageDiv… although similar results
could be achieved either way, I suppose. To avoid the problem with the
FirstDiv height of 100%, I set the height to PX (whatever the page height
minus the combined heights of the bottom items) and then Extended the item
height to 100%. This will keep the appearance in the workspace from going
nuts while also preserving the output code.

I was unsure how literal you wanted to follow the example… FWP uses id
styles for structural stuff and the example uses class styles instead. So I
used Max Fancourt’s ID to Class action to convert the id styles to class
styles. There are some drawbacks to using this action - first the styles
are written into the document head instead of being swept into the css
stylesheet and externalized. Also, FWP still writes the id styles to
external stylesheet, regardless.

So, this is as close as I can get with FWP6 (5.6mb) -
http://cssway.thebigerns.com/richardvans-quest/Resources/richardvans-quest.zip


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ernie - 404 on your link

Would like to see what you have done

D


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry guys…
http://cssway.thebigerns.com/workbench/richardvans-quest/Resources/richardvans-quest.zip


Ernie Simpson

On Sat, Nov 30, 2013 at 11:05 AM, DeltaDave email@hidden wrote:

Ernie - 404 on your link

Would like to see what you have done

D


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s a matter of fact I started with using a surrounding div, containing ‘the others’. After experiencing the issues mentioned above I removed the surrounding div, and started inserting the html items directly into the PageDiv (obviously without result).

Funny thing is that I’ve been fiddling around with the ‘ID to Class action’ as well, the example shown however is without the action applied … trying to get my vinger on the sore spot.

I guess this is a typical example of me trying too hard, looking too far for the obvious solution(s). Walter, Dave and Ernie all pointed that out very clearly … but I tap my hat for you guys, thanks (again) for the effort, but It’s great to see that you can accomplish a lot with FWP :slight_smile:

Now let’s see what else I can come up with :wink:

I will try all three options offered by you, perhaps every occasion needs another solution …

Have a great weekend!

Richard


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Richard, I went back and reworked my example using the PageDiv as the first
div (like you seem to have intended). Also, I backed off being literal
about your example - so I let FWP manage the item styles through id’s
instead of classes.

Then I added some other stuff to make it look more like a practical
example, with a link to download the file -
http://cssway.thebigerns.com/workbench/richardvans-quest/

Best,

Ernie Simpson


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Wow … that’s looking awesome (again) …


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options