I have a question relating to the use of javascript within a HTML based website. It seems that some browsers may strip out javascript. Is this still the case?
I am attempting to build a one page scrolling website where the action of scrolling fires animations backwards and forwards depending on whether the user is scrolling up or down.
I used the below as a basis but wondered, if javascript is an issue, is there a way to build a website using the below but in HTML?
First, if you're worried about that, then Hype isn't a solution. It simply doesn't work when JavaScript is disabled. The best it can do in that scenario is display a placeholder picture.
Next, if a visitor is blocking JavaScript on the modern Internet, then they're probably used to disappointment.
Third, which web browser are you worried about? In Safari, I can turn off JavaScript, but that's not an easy thing to do. The option to "Disable JavaScript" is in the Developer section.
Perhaps you might be worried about browsers that protect privacy. I'm not sure, but perhaps a third-party JavaScript file might be blocked. That might break your Hype project, if you were hosting the runtime on a third-party site.
…and in general, I don't know why that web page layout style caught on. Apple did it with the 2013 Mac Pro and I didn't like the design. It gets in the way of usability.
That's really useful guys. I think the answer is go for it, using the javascript as all the javascript I will use will be directly based within Hype fortunately.
I guess the safari's of the world tend to be ok with javascript. It's more the commercial browsers used in the office environment such as the dreaded IE etc, Chrome maybe? I tried previewing with Chrome and it made the file really small on the screen but thats something that can be fixed I hope?
One thing I do see on the web is when a site has an image that fills the width of the screen, but when you make the page smaller manually instead of squeezing the image it makes the image slightly smaller and it shows less of the image on the page. I assume that is set up with the tools here, but not sure how at the moment?
Correct, this is the Flexible Layout system. You will need to enable the width and/or height scaling first in the scene inspector and then select an element for the options to be available. Please see:
Thanks Jonathan, might be easier if I upload it. I dont think I have done it correctly? Sometimes the text gets hidden, depending how the browser is sized. This is a fundamental issue that I need to understand I think before I carry on. Do you have time to take a look?
Thanks Jonathan. When I squeeze the width it gives a horizontal letterbox effect and the same when I squeeze the height, a vertical letterbox effect. Is it possible to keep the black background or image to fill all of the screen without the image distorting?
The thing to know is that zoom contents takes the visual contents of everything inside an element or a group and scales it like a bitmap (though in many cases the browser can re-render stuff like text to make it sharp).
Not all items need to be proportionate, so you can either:
move these outside the main group and then put your own flexible layout settings on them to scale as needed
Turn off zoom contents for the group, turn off the scaling behavior, and then set individual elements to scale and pin however you see fit (some elements like text may need zoom contents still turned on).
(You could also set the scene's background color to just be black in this case, but that might not hold up depending on future plans you want for a background .)