Sliding jQuery form borders

After successfully implementing the sliding form using jquery, I encountered a challenge. When clicking on the link, I wanted the form to have a border like this:

However, when I tried adding a border for both elements, it ended up looking like two separate borders.

Check out the desired border effect here

This is the code I used:

View the code here

I'm struggling to achieve the desired border effect that encompasses both the link and the form. Any help would be greatly appreciated.

Answer №1

Initially, I made a modification to the #add click function in your jQuery script by adding CSS to the u286 id and then removing it later.

$('#add').click(function () {
    if ($('#sliding-form').is(":hidden")) {
        $('#sliding-form').slideDown('slow');
        $('#u286').css({
            'border':'1px solid #000',
            'border-bottom-color':'white'
        });
    } else {
        $('#sliding-form').slideUp('slow');
        $('#u286').removeAttr('style');
    }
});

UPDATE: In your CSS file, I made some adjustments. I positioned the #bottom-header div on top of the #sliding-form div to create a white gap. Here are the changes I implemented:

  1. Added position: relative; to the .container class,

  2. Added

    #bottom-header { position: absolute; z-index:10;}
    ,

  3. Added background:#fff; to #u286,

  4. Removed .mouseOver {background:#fff;} as it had no effect,

  5. Changed top: 30px; to top: 26px; in #sliding-form.

I hope these modifications align better with your preferences!

View updated jsFiddle

Refer to this helpful StackOverflow question/answer about overlays

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

"Utilizing jQuery for dynamically adding input fields and triggering AJAX requests based on user

I'm working with a dynamic table that has multiple input fields. I need to add an event listener for every ID textbox, another one for each quantity field, and trigger an AJAX call. Additionally, I want to detect when the subtotal value changes and dy ...

How can I use a jQuery selector to target all class names that start with a specific prefix, even if multiple classes are

I'm exploring a unique selection statement that will identify specific css classes in a single class attribute by using a string prefix. For instance, I am looking to target any class names prefixed with detail- from the set of sample links below. ...

Trouble with Jquery Library Clash: Overlay Feature Malfunctioning

Having a JQuery conflict is causing two functionalities on my website to not work together. I've attempted to rearrange the script order and change the $ function to the jQuery function, but it doesn't seem to resolve the issue! <div id="ma ...

Attention! Are you aware of the potential consequences of the impending phase-out of the name attribute in W3C validation? Have you considered how this development

Any thoughts on what could replace the name attribute? According to the W3C validator... Validation Output: 4 Warnings Here is a list of the warning message(s) generated while checking your document. Warning Line 12, Column 21: The name attribute i ...

Is there a way to retrieve the value of a particular attribute while hovering the mouse over it?

When I hover my mouse over the innerHTML content, certain words are highlighted with a title attribute value. How can I retrieve the specific title value of the content I am hovering over? This should be done using the mouseover event in the TypeScript fil ...

What methods does a browser use to identify SCSS files?

While exploring this html template in Chrome's inspection tool, I was amazed to see that the browser was able to detect the scss files instead of the compiled css version. To investigate further, I pressed Ctrl+U to view the page source, hoping to fin ...

What is the proper way to structure a $.ajax call when using the $.getJSON method?

During a recent project, I needed to obtain the user's latitude/longitude using HTML5 geolocation and then utilize a weather API to retrieve the current weather at that location. While working on this task, I discovered two different methods - $.getJS ...

The block remained stationary despite the keyframes being applied

I'm having trouble getting the block to move using keyframes. Keyframes are new to me, so I'm struggling with it. #block{ width: 20px; height: 20px; background-color: blue; position: relative; top: 130px; left: 480px; ...

Stylish curved bottom border

Is it feasible to create this footer using just CSS? https://i.sstatic.net/b33w4.png Appreciate the help! ...

What could be causing the div containing this flot chart to not resize properly when the $route is changed in AngularJS?

Whenever I navigate away from the main screen and then return, I notice that the graph does not resize correctly. Here is the HTML code, with some styling for debugging/testing purposes: <div class="panel-body" ng-show="graphType !== 'Mood Sentim ...

Sending form data using Ajax in codeigniter

I am encountering an error while attempting to submit a form using ajax in codeIgniter. Below is the view code that I have: <div class="form-group input-control"> <p id="error1" style="display: none; color: green"><b>Registered Succ ...

Using Backbone.js to Retrieve Data from the Server and Bind it to a Model

Having recently delved into Backbone.js, I found this informative tutorial quite helpful in getting started. Now, I am looking to take things a step further by fetching data from the server instead of hardcoding values in JavaScript as demonstrated in the ...

Issue with transition effect not functioning properly when hovering in HTML and CSS

Is there a way to achieve a slow smooth transition when hovering over the .bg-gradient element and have the same effect when removing the cursor? Currently, the transition happens quickly on hover. .asc { height: 500px; background-position: 50%; ...

Placement of the image is not above the card (nth-of-type(odd)) when viewed on smaller screens

I have a set of cards that display an image either on the left or right side, depending on whether it's an odd or even numbered card. On smaller screens, only the even numbered cards show the image at the top, while the odd numbered cards hide the ima ...

Invoking a web service using jQuery remotely

This piece of code is causing issues for me when I try to host Data.ashx locally. Interestingly, it seems to work fine when I use the URL pointing to Data.ashx on my local machine. jQuery.ajax({ type : "GET", url: "http://aspspider.ws/ghadyAlham ...

What is the best way to extract a URL parameter from the parent page and pass it to an iframe using JavaScript?

Currently, I have embedded a form within an iframe on a specific landing page. Visitors arriving at this landing page through an affiliate link will have a parameter added to the URL (http:thelandingpage.com?c3=1). After they submit the form within the ifr ...

Different methods for dynamically altering the style attribute

Here's some code I wrote: <html> <head> <style> .containerTitle { background-color:silver; text-align:center; font-family:'Segoe UI'; font-size:18px; font-weight:bold; height:30px; } ...

Constructing an HTML form that includes radio buttons and integrating PHP for processing the

I have created an HTML form with radio buttons and I am wondering how to determine which button has been selected. I want to send the selected option to my email address, but I'm not sure how to integrate this into my PHP script. Thank you for any hel ...

Step-by-step guide on displaying a checkbox list based on the selected option in a drop-down menu

Apologies for the lackluster title. My goal is to create a dynamic checklist based on selections made from a drop-down menu: The drop-down menu offers several options, and when a choice is made, I want a corresponding checklist to appear below it with dep ...

PHP, HTML, Email - Special characters in emails are being altered into other symbols

Here's the Situation... I am currently utilizing PHP to send out emails in a conventional manner... Snippet 0 mail('', $subject, $message, $headers); ... with the following content setup: Snippet 1 $boundary = uniqid('np&a ...