CSS PopUp positioning

Can anyone help me with applying the position top and bottom of header to the NewUser div? I've tried but it's not working. How can I add !important; to the CSS? Maybe something like $("header")!important}

<div id="divNewUser" class="CreateUserModal" runat="server">
    <p>
        Use the form below to create a new user account.
    </p>
</div>

<script>
    function showDialog() {
        var modal_dialog = $("#divNewUser");
        modal_dialog.css({     
            position: { 
                my: "top", 
                at: "bottom", 
                of: $("header")
            }     
        });
    }
</script>

    <div id="accountname1" style="position:relative;float:right">
        <div id="divLogin" style="position:relative; margin-right:1px; margin-top:1%; float:right">
            <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                <anonymoustemplate>
                    <img src="/images/btn_login.png" alt="Login" />
                    <a href="~/Account/Login.aspx" ID="A3" runat="server" title="Sign in with your account details">Login</a> |
                    <a id="A4" href="~/Account/Register.aspx" runat="server" title="Sign up for your 30 days free trial">Free Trial</a>
                </anonymoustemplate>
                <loggedintemplate>
                    Welcome <span class="bold"><asp:Label id="UserLogonID" runat="server"></asp:Label></span>
                    <br />
                    [<asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/Account/login.aspx" />]
                    <br />
                </loggedintemplate>
            </asp:LoginView>

            <p style="text-align:right">
                <asp:Label ID="lblFreeTrialDays" runat="server" Text=""></asp:Label>
            </p>

        </div>

        <div id="mobile-btn">
            <img src="/images/menu_btn.png" alt="Menu Button" />
        </div>


    </div>
</div>

Answer №1

VISIT EXAMPLE SITE

Revise your Javascript snippet :

$("#userDiv").position({
                 my: "bottom",
                 at: "top",
                 of: "main"

        });

Answer №2

<script>
function displayPopup() {
    var popup_window = $("#divNewUser");
    popup_window.addClass("custom-style");
    });
}

.custom-style{
    top:20px;
    bottom:20px;
    }

This is how you can adjust the position of an element.

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

Global object remains unaltered by jQuery AJAX success handler

Within my coding snippet below, I have constructed a function that incorporates asynchronous loading of all essential files required for an application. Once all the files are successfully loaded, the app execution progresses: function loadDATA(){ var ...

Using jQuery to add HTML elements before the content of a list

I'm facing a challenge in dynamically adding new elements to my list. Through ajax, I retrieve HTML data from my database and aim to iterate through each new <li> element to gradually prepend them to the top of the list. This is the snippet of ...

I have tried to create two apps in AngularJS, but unfortunately, they are not functioning as expected

Having trouble with implementing 2 ng-app in a single html page. The second one is not working. Please review my code and point out where I am making a mistake. <div id="App1" ng-app="shoppingCart" ng-controller="ShoppingCartController"> &l ...

Tips for configuring jQtree to initially display the tree structure from the HTML source

Up to this point, I have utilized jQuery TreeView for the navigation menus on my website. However, as the main navigation menu has grown significantly in size (40869 bytes out of 67054 bytes), I am seeking a way to streamline it by using AJAX calls to fetc ...

Interacting with Watir and Cucumber, unfortunately the link is not functional

Being new to the world of Watir and Cucumber, I am currently in the process of running an automation script to create Live IDs. The link that I want to click on the webpage is labeled "New" and it should take me to a form where I can add a new contact for ...

Ways to retrieve an input field value without triggering form submission

I'm currently working on a payment form where users input the amount in a text field. I also have another text field on the same form that should automatically display the amount in words based on the user input. However, I'm struggling to figure ...

Place a small image within a list item to ensure it matches the height of the list element

I need help aligning images to the right within list elements. The images are squares with equal height and width, and I want them to fit snugly within the height of the list element on the right side. My HTML code is quite simple for now (see example bel ...

WebDriverException: Error: {"errorMessage":"The object is undefined"

I encountered an error while running the code on this HTML page, specifically at /html/body/div[3]/div[1]/div[1]/div[1]/div/div[10]/a/div[1]/div[2]: WebDriverException: Message: {"errorMessage":"null is not an object (near '...ull).singleNodeVa ...

Tips for maintaining tab state using Angular Material

In my Angular 8 application with Angular Material, I have implemented four tabs where each tab allows editing. However, when going back from the edit mode to the tabs, I want the last selected tab to remain selected. My approach so far is as follows: exp ...

Manipulate the <title> tag using jQuery or PHP

I have my own personal blog and I am trying to change the title tag dynamically when viewing different blog posts. My goal is to have the post title show up in the Twitter tweet button. I attempted the following methods: <script type="text/javascript"& ...

What could be causing the appearance of a mysterious grey box hovering in the upper left portion of my image and why is the code only adjusting the size of the grey box instead of the entire

I've been working on embedding some JavaScript into my Showit website to create a drag-and-drop feature that displays a collage/mood board effect. Everything is functioning correctly, but I'm running into issues with resizing the images. There&a ...

Container struggling to contain overflowing grid content items

While creating a grid in nextjs and CSS, I encountered an issue. Whenever I use the following code: display: grid; The items overflow beyond the container, even though I have set a maximum width. Instead of flowing over to the next row, the items just kee ...

Tips for evenly distributing list elements in HTML without using whitespace

After reading the article on flexbox techniques without actually using flexbox, I attempted to implement "space-between" in my code: ul { margin: 0; padding: 0; text-align: justify; } ul:after { content: ""; display:inline-block; width:100%; ...

Exploring Techniques for Streamlining HTML/CSS Editing in Browser

Is there a way to automatically edit specific lines on websites right after they load? Specifically, I want to change <div class="1"> to <div class="1" style="display:none">, and <div class="2" style ...

What's the best way to conceal scrollbars in Nuxt2 whilst preserving one for the description?

The Issue My goal is to remove scrollbars from all pages (which I achieved successfully), but keep one visible for a specific section of description. What I Attempted I tried adding the class .scroller and only displaying it for the <div> containi ...

Creating a CSS background that adjusts to fit any screen resolution

Hey there, I'm a beginner to all of this. I want my background image to adjust to fit any web browser resolution, regardless of the size. So far, I've come across this nifty little trick: html { background: url(images/bg.jpg) no-repeat center ...

Mix up table data cells using Javascript/jQuery

Can anyone provide me with some helpful tips? I'm really struggling with this. My Objective I aim to create a table with two columns ("name" and "rating"), consisting of 5 rows. 2 of these rows should have a random "rating" between 6-10 2 other ro ...

Safari iOS does not display any background for Buttons

Encountering an unusual problem with buttons on iOS devices specifically in Safari browser - the background color isn't being applied like it is on Desktop and Android devices. Here are the CSS properties for the button: export const Button = styled.b ...

Adjusting the size of FontAwesome symbols using FitText

I recently started using FitText () to dynamically resize certain titles on my webpage. While I've had success with resizing h1, h2, and other text elements, I've run into an issue when trying to apply it to fontawesome icons. I know that FitText ...

Exciting jQuery animations and transitions

Is there a way in JavaScript to call function or method names using a string? For example, when writing jQuery code that applies an effect to specific targets, can the effect be dynamic and changeable by the user? I'm hoping for something like jQuer ...