Incorporating full-screen viewing in the browser, these websites provide a seamless user experience with a "learn more" button strategically placed at the bottom. This button effortlessly

Have you ever noticed how websites like Heroku.com and dropbox.com automatically display a full-screen homepage tailored to your browser size? They have a clever button at the bottom that smoothly scrolls you down the page for more information. Have you wondered how they achieve this effect? If so, can someone assist me with setting up a simple code to replicate it?

I've created a basic outline over here http://jsfiddle.net/WwHP6/, but I'm struggling to implement the full-screen functionality and the 'learn more' link.

HTML

<div class="page1">
    <nav class="navigation">
        <ul>
            <li>Home</li>
            <li>Support</li>
            <li>Sign Up</li>
            <li>Contact</li>
        </ul>
    </nav>
</div>

<div class="page1-content centered">
        <h1> Generic Header</h1>
        <h2> Generic Content 1</h2>
        <h2> Generic Content 2</h2>
        <h2> Generic Content 3</h2>    
</div>    

<div class="learn-more centered">
    <a href="#learn"> learn more </a>
</div>


<div class="page2-content">
    <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tel...
</p>
</div>

CSS

body {
    background: blue;
    color: white;
}

.centered {
    margin: 0px auto;
    position: relative;
    vertical-align: middle;
    text-align: center; 
}
nav {
  list-style: none;

}

.navigation ul li { 
    list-style: none;
    float:left;
    margin: 5px;
}

.page1-content {
    clear:both;
}

.learn-more a {
    color:red;
}

.page2-content {
    margin: 200px 0 auto;
    background-color: white;
    color: black;
    background-size: 100% 1000px;
}

Answer №1

Take a look at jQuery.ScrollTo, it seems like it may be just what you need.

I've also put together a Demo Fiddle to show you how to implement this. Hopefully, it will be useful for you.

Below is the script:

$(document).ready(function (){
            $("#click").click(function (){
                //$(this).animate(function(){
                    $('html, body').animate({
                        scrollTop: $("#text").offset().top
                    }, 2000);
                //});
            });
        });

Answer №2

Not entirely sure what you're looking for, but hopefully this information will be helpful:

http://jsfiddle.net/WwHP6/1/

To summarize: Wrap a div around your "page1"-Div and make it the size of the screen.

CSS

body, html{
    width:100%;
    height:100%;
    padding:0px;
    margin:0px;
}

.page1_wrapper {
    height:100%;
    width:100%;
    overflow:hidden;
    border:1px solid red; /* just needed to show the size of the div */
}

Scrolling can be achieved with simple anchor tags. However, clicking on them will jump to the anchor without playing an animation or transition. To incorporate this, JavaScript would be required. For instance, JQuery offers scrollTo() function.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to create a table using a loop in an SQLite query?

Welcome In the company where I work, Excel is currently being used to manage a large database of items for cost estimation purposes. To simplify this process, I am developing an Electron App that will replace Excel with a more user-friendly interface and ...

Struggling with the conundrum of aligning a constantly changing element amid the

I was optimistic about the code I wrote, hoping it would work out in the end. However, it seems that my expectations might not be met. Allow me to provide some context before I pose my question. The animation I have created involves an SVG element resembl ...

Ways to implement the CSS on images with an ID such as img120 within a div that has a class of 'open'

<div class='cluster' id='12' 'style='width:350px;min-height:150px;border:4px solid #339966;'> <div class='image' style='width:150px;height:150px;border:2px solid black;float:left;margin-bottom: ...

Passing Data Between Blazor App Pages Using .NET Core

Recently, I began learning how to create websites using the Blazor template. I'm having trouble figuring out how to pass data from one page to another. It's quite different compared to .NET CORE MVC web applications and I haven't been able t ...

SQL Query: Change text color based on the result number retrieved

After executing my SQL SELECT statement, I want to display every record in a div using a While statement. I would like the divs to alternate in color, for example: Result 1 = white div Result 2 = grey div Result 3 = white div Result 4 = grey div. I am un ...

Is there a way to adjust the background hues of a React component when a click event is triggered?

Currently, I have 3 React components that each consist of a div element. When I click on one component, I want to change its background color to black. If I then select another component, the previously selected component should return to its normal back ...

Exploring the depths of JSON

After requesting data from my server, I received the following dataset: {"success":"y","carrier":"Verizon Wireless","isMobile":"true"} Upon attempting to parse the JSON result returned from my ajax function $.ajax( { url: 'php/lookup.php', ...

Is it possible to forecast an on click event using jQuery?

I have encountered a specific issue. Within my code, there are certain elements, specifically <li> elements, that undergo a particular operation triggered by a click event: $('.panelTabs li').on('click', function () { // ..som ...

Link the controls to an HTML table after clicking the button

I'm very new to programming and I'm seeking your help and guidance in order to improve myself. Here is the code where I am trying to add a control to an HTML table upon button click, but I am facing difficulties in its execution. Can anyone assis ...

Ajax response data triggered twice

I'm struggling to understand why my data is being called twice. I attempted to replace 'append', but it's not working. I suspect the issue lies within my controller. Here is my Ajax call: jQuery(document).ready(function($) { $('# ...

Wordpress users encountering a Javascript issue with Slider Revolution 5.0

Currently working on a WordPress template in LAMP environment, incorporating Revolution Slider for sliders. I have successfully created the slider and added it to the home page. However, upon checking the home page, the slider is not functioning as expec ...

What is the best way to iterate through my array and display each value within my button element?

I have a challenge where I'm trying to iterate over an array named topics. This array contains the names of various people. Within my loop, my goal is to extract each name and insert it into a button as text. When I use console.log within my loop, I ...

My React application is not showing the CSS styles as intended

In my project, I have a component file named xyx.js where I properly imported my scss file './xyz.scss'. Both of these files are in the same folder. Interestingly, when I view the styles using the Chrome scss extension, everything seems to be wor ...

Internet Explorer version 8 and above tend to load HTML at a slower pace compared to other web browsers

I have encountered a problem while loading ten separate dropdown lists, each containing around 13,000 options from the same data set. Despite confirming that the issue lies within the HTML rather than the code used to populate them (by saving and directly ...

Having trouble with WebRTC video streaming on Firefox?

I have implemented one-way broadcasting in my Dot Net MVC website for video streaming using the example found at https://github.com/muaz-khan/WebRTC-Experiment/blob/master/webrtc-broadcasting/index.html. While it works perfectly in Google Chrome, unfortuna ...

Pause the jquery script when a key is pressed

Currently, I have a script that loads a php file within a div and automatically refreshes every 5 seconds. Check out the code below: $("#load_timeout").load("time_out.php"); var refreshId = setInterval(function() { $("#load_timeout").load('time_o ...

"Create a Single-Page Bootstrap Website with a Responsive Design showcasing PHP Code within the Contact Form

Working on the final touches of a single-page responsive website project for a client. Utilizing a Bootstrap contact form located at the bottom of the HTML document. The PHP code is unexpectedly displaying in the text fields of the contact form. I've ...

What steps can I take to ensure that the full tingle modal, which includes an image, is visible when the

Upon loading the page, I noticed that if the browser width is greater than 540px, the modal displaying an image gets cut off (see figure below). What steps should I take to ensure that the vertical scroll bar appears immediately? https://i.sstatic.net/cJv ...

Problem with aligning an image horizontally within a DIV

Can anyone help me align the picture of the planet horizontally in the middle of the DIV section "about us" on my website? I've tried using text-align:center; in the CSS but it doesn't seem to work. Any suggestions would be appreciated. Thank you ...

Error Detected: the C# script is not compatible with Javascript and is causing

I am facing an issue where I can successfully send information from the database, but I am unable to load the table on the page. When I check the data received with an alert, it appears to be in JSON format, but it still displays the wrong image on the web ...