The Angular Material FAB Speed Dial feature is causing a slight offset within the Toolbar

Attempting to incorporate design examples from the angular material site, I am utilizing Angular Material 1.0.0RC5.

I am aiming to position the FAB Speedial within the Toolbar, similar to the example demonstrated on their site: https://material.angularjs.org/latest/demo/fabSpeedDial https://i.sstatic.net/e0vFC.png

However, upon applying the code I found on the page, I encountered a strange offset issue that I could only rectify with a margin-top:-23px. I suspect there might be a mistake in my implementation.

https://i.sstatic.net/773Mp.png

The offset problem is also visible in the codepen example from the site, indicating the same bug when exceeding a certain size https://i.sstatic.net/Um9oC.png

What am I doing wrong?

Below is the code snippet for reference

<body ng-app="starterApp" layout="column" ng-controller="AppController as ac" ng-cloak>
    <md-toolbar>
        <div class="md-toolbar-tools">
            <h2>
                <span>Toolbar with Icon Buttons</span>
            </h2>
            <span flex></span>
        </div>
    </md-toolbar>
    <md-fab-speed-dial md-open="isOpen" md-direction="down" class="md-scale md-fab-top-right">
        <md-fab-trigger>
            <md-button aria-label="menu" class="md-fab md-warn">
                <md-icon md-svg-src="menu"></md-icon>
            </md-button>
        </md-fab-trigger>
        <md-fab-actions>
            <md-button aria-label="Twitter" class="md-fab md-raised md-mini">
                <md-icon md-svg-src="android" aria-label="Twitter"></md-icon>
            </md-button>
            <md-button aria-label="Facebook" class="md-fab md-raised md-mini">
                <md-icon md-svg-src="windows" aria-label="Facebook"></md-icon>
            </md-button>
        </md-fab-actions>
    </md-fab-speed-dial>
    <div layout="row" flex>
        <md-sidenav layout="column" class="md-sidenav-left md-whiteframe-4dp" md-component-id="left" md-is-locked-open="$mdMedia('gt-sm')">
            <md-button class="md-accent">Button 1</md-button>
            <md-button class="md-accent">Button 2</md-button>
        </md-sidenav>
        <div layout="column" flex id="content">
            <md-content layout="column" flex class="md-padding">
                This Starter Application consists of a Toolbar, SideNav (with two buttons), and Content area.
                <p>This is the content area! </p>
            </md-content>
        </div>
    </div>

Answer №1

Check out this cool pen

I simply adjusted the margin-top value from 89 to 16 and everything seems to be functioning correctly now. Let me know if that's what you were referring to.

Answer №2

The reason their menu bar works while yours doesn't is because they have an additional element placed above it. To make it work, they adjusted the CSS with "margin-top: 89px;" and "top: 16px;".

To fix yours, you just have to change the margin-top value in the CSS code they provided.

.fabSpeedDialdemoMoreOptions md-fab-speed-dial {
  margin-top: 65px;
}

Check it out here

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

How can XPATH be written for an HTML tag that contains spaces before and after the text, such as <button>spaces text spaces</button>?

When developing a selenium-java script, I encountered an issue while trying to assert the text "Export All". The spaces between the HTML tags are causing difficulties in asserting it. I am seeking assistance in writing the xpath for this scenario. Can any ...

Using ng-repeat to asynchronously load background images from a specified URL

Imagine there is an API that retrieves a collection of blog posts, with each post having its own unique background image link. <article ng-style="{'background-image': 'url({{ post.meta.cover }})'}" ng-repeat="post in blog.listOfPost ...

What is the best way to ensure the box div is centered responsively?

Here is the code for my HTML file: body { background-color: rgb(231, 59, 59); font-family: "Alata"; font-size: 20px; margin: 30px; } h1 { margin-top: 100px; color: #202124; text-align: center; } .box { width: 1000px; } input { positi ...

Displaying PHP error location

Here is the PHP code snippet I am using: if($_SESSION['msg']['login-err']) { echo '<p class="error">'.$_SESSION['msg']['login-err'].'</p>'; ...

Horizontal Scroll HTML

Currently in the process of building a website for my father, everything is going smoothly. I followed a helpful Stackoverflow tutorial to create a specific webpage that I now want to customize with a hyperlink and make it scroll horizontally: Sliding divs ...

What is preventing the unordered list from aligning to the right of the h1 element?

The following HTML code showcases the structure of a front-end web developer's webpage: <html> <head> <title>Front-end Web Developer</title> <link rel="stylesheet" type="text/css" href="css/style.css"> </head& ...

`I am experiencing issues with the HTTP Post functionality`

Whenever I click on the button displayed in the index.html code, an error occurs when the "$http.post" call is made. The web page then displays an alert saying 'Error!', preventing me from saving the new JSON file due to this issue. I need help ...

Creating a custom loading spinner featuring your logo

Hello, I am looking to create a custom loading spinner using CSS, JS or any other method with my logo. I have the logo in PNG, GIF, and SVG formats and would like to use it for long site loads, image loads, or any other loading processes within my Vue3 pro ...

"When the screen resolution changes, the absolute positioning of images won't function as expected

I am trying to overlay one image on top of another background image, but I am facing an issue. When I change the screen resolution, the position of the image that should be placed over the background image also changes. Below is the code I am using: ...

Automatically populate email fields with pre-filled form data

Looking to create an HTML form that utilizes JS/jQuery (no PHP) to capture data from "subject" and "message" fields and send an email. The goal is for the client-side code to open the user's mail client, pre-fill the subject and body with form data, a ...

AngularJS displays the value from the dropdown menu in the input field

I am looking for a way to display the text "login" and "password" from $scope.logins when a user clicks on them in a dropdown menu. $scope.logins = [{ "login" : "log", "password" : "pass" }] Here is the HTML code: <div class="drop ...

The appearance of the pop-up mask is displayed at lightning speed

Check out the demo here Here is the HTML code: <div class="x"> </div> <input class="clickMe" type="button" value="ClickMe"></input> This is the JS code: $(".clickMe").click( function() { ...

Utilizing jQuery for various dynamically generated HTML elements

I am currently working on a form for editing data in my database. The form consists of three dropdowns: Category, Subcategory, and Item. These dropdowns are dynamically populated based on the selection made in the previous dropdown. After all three dropdow ...

Clicking the button to send the form using JavaScript

Currently, I am dealing with a shopping cart plugin that relies on a basic form on the product page to send values such as price and product name. However, I am facing an issue where this plugin uses a standard submit button to transmit the values, and I w ...

Separate a JSON string into smaller parts and showcase each part using ng-repeat

<div ng-controller="countryCtrl"> <div class="m-b-20" ng-repeat="val in records"> {{val.Country}} <br> </div> </div> var app = angular.module('app', []) .controller('countryCtrl', ['$scope&a ...

How can Angular.js directives help display various nested data structures?

Is there an Angular.js directive available for displaying nested JSON data dynamically as a view without prior knowledge of the structure? Let's say we have the following JSON resource at a REST endpoint /api/orgranisations/:organisation_id/: { ...

I am looking to transfer the data stored in a variable within a JavaScript function to a different PHP page

Here is my form featuring the summernote editor: <form class="form-group" action="upload.php" style="width: 700px;" method="post" enctype="multipart/form-data"> <label> Title: </label> <input name="title" class="form-c ...

Tips for overriding bootstrap.css file in mvc asp.net using Visual Studio

I am currently working on creating a website using Mvc asp.net in Visual Studio 2013. I have integrated my css file, 'style.css', into the project, but I am encountering unwanted white spaces and margins around headers and other key elements, eve ...

Timepicker Bootstrapping

I've been searching for a time picker widget that works well with Bootstrap styling. The jdewit widget has a great style, but unfortunately it comes with a lot of bugs. I'm on a tight deadline for my project and don't have the time to deal w ...

Disabling $routeprovider while implementing bootstrap

I am encountering an issue with my normal routeprovider code. In a specific section of my HTML, I have some Twitter Bootstrap expand/collapse sections which inadvertently trigger the routeprovider when clicked. Is there a way to prevent this from happening ...