Creating a unique seat arrangement resembling airplane wings

I am facing a challenge of creating a seatmap for airplanes using only HTML, CSS, and jQuery. While this task is generally manageable, I'm struggling with how to incorporate wings into the design. Currently, I differentiate seats located over the wings by adding a darker outside border, but I find this approach unappealing. I would prefer to integrate some form of "wings" directly onto the plane or at least have an outer border outlining the plane's shape. Do you have any suggestions on how to achieve this?

<div id="seatmap">
        <div id="plane">
            <table class="rows">
                <tr>
                    <td>F</td>
                </tr>
                <tr>
                    <td>D</td>
                </tr>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td>C</td>
                </tr>
                <tr>
                    <td>A</td>
                </tr>
            </table>

            <div id="cabin">        
                <table>
                    <!-- Seat rows and attributes -->
                </table>
            </div>
            <div style="clear: both;"></div>
        </div>
    </div>
    

Fiddle 1: http://jsfiddle.net/SchweizerSchoggi/0Lu4vspq/1/

Check out my updated Fiddle for a clearer visualization of where the wings should be situated -> Fiddle 2: http://jsfiddle.net/SchweizerSchoggi/0Lu4vspq/3/

The main issue remains wanting the border to outline the exterior of the plane rather than inside the cabin.

Answer №1

Here is my innovative solution, utilizing a CSS approach for creating the two wings:

Check out the code here

#wings {
    border: solid 5px #333;
    width: 80px;
    position: relative;
    left: 155px;
}

Incorporate the following snippet before and after your existing code.

LATEST UPDATE

You have the option to dynamically adjust the CSS using PHP. It's crucial to consider that there are only two wings on a plane.

If the wing positions align (or even if not, you can use separate CSS rules for the left and right wings), you simply need to determine the starting point of the wing and its length.

The CSS modifications would be as follows:

#wings {
    border: solid 5px #333;
    width: 80px;   % <-- Adjust the wing length
    position: relative;
    left: 153px;   % <-- Define the starting point of the wing
}

UPDATED DESIGN

If you desire a more intricate wing design, the CSS styling should be as shown below:

#wings_down {
    left: 155px;
    width: 80px;
    position: relative;
    height: 50px;
    -webkit-transform: skew(20deg);
       -moz-transform: skew(20deg);
         -o-transform: skew(20deg);
    transform: skew(20deg);
    background: #333;
}

#wings_up {
    left: 155px;
    width: 80px;
    position: relative;
    height: 50px;
    -webkit-transform: skew(-20deg);
       -moz-transform: skew(-20deg);
         -o-transform: skew(-20deg);
    transform: skew(-20deg);
    background: #333;
}

Explore the updated design here

Please note: The border: solid 5px #333; declaration has been removed as it is unnecessary.

Answer №2

Experimenting with styling, I decided to apply the classes wingRowTop and wingRowBottom to the tr element containing the wingseat.

For a visual demonstration, you can view the changes in this JSFiddle link.

An alternative approach involved using :before pseudo-elements on the first cells to introduce a sloped effect on the wings (highlighted in red). Here's the updated example: JSFiddle link.

Utilizing negative margins and border-collapse properties, I was able to achieve the desired outcome. With additional HTML classes and adjustments like border-radius, it might be feasible to create a wing-shaped appearance within the cells.

.wingRowTop {
border-collapse: collapse;
border-spacing: 0px;
position:absolute;
margin-top:-37px;

}
.wingRowBottom {
position:absolute;
border-collapse: collapse;
border-spacing: 0px;
}
#cabin tr:first-child td.wingSeat { background-color: #DEDEDE; border-right:5px solid #DEDEDE;}
#cabin tr:last-child td.wingSeat { background-color: #DEDEDE; border-right:5px solid #DEDEDE

Answer №3

After coming across this post, I found it quite interesting as I happen to be developing a simulator for airport check-ins. Thank you @SchweizerSchoggi for sparking the idea and fueling my inspiration.

One feature that could enhance the simulator is a seat map generator. I have created an initial version on this playground: http://jsfiddle.net/Mikebert4/0Lu4vspq/34/

In the future, I plan to transform this into a proper constructor object like so:

var seatmap = new SeatMap(options);

Currently, the tool only visualizes complete rows of seats by using Math.floor() to determine how many rows to display. Nevertheless, it's a good starting point!

Answer №4

I just wanted to express my gratitude for the incredible support I have received from everyone! Ultimately, I have decided to combine elements from both of your suggestions: Wf4 provided valuable insights on wing positioning and crafted a detailed plan for the "wings outside the cabin" approach. Giacomo Alessandroni also contributed a brilliant concept for the wings layout.

If you're interested, here is the link to my final Fiddle project:

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

Could you identify the unique patterns present in this specific Backbone TodoMVC demonstration?

Exploring the todomvc backbone codes example, focusing on the structure within the js/ directory: ├── app.js ├── collections │   └── todos.js ├── models │   └── todo.js ├── routers │   └── router.js ...

Steps to include a HTML webpage within another page

I need assistance with a scenario involving two separate HTML pages on different servers. Merchant Form - Server A Payment Form - Server B Here's the desired scenario: The user completes all necessary fields on the Merchant Form and clicks submit. ...

Struggling to properly line up the baselines of navigation list items that are styled as circular elements using CSS

I have transformed my navigation menu into a series of CSS circles with text inside. The issue I am facing is that the text spills out unevenly based on the amount of content in each circle. To address this, I used a JavaScript solution to center-align the ...

tips for concealing the sorting icon in the DataTables header upon initial load

Is there a way to initially hide the datatable sorting icon upon loading, but have it display automatically when clicking on the header? I've been searching for a solution without success. https://i.sstatic.net/o2Yqa.png ...

The process of transmitting messages back and forth between a popup script and a content script

I am in the process of developing a Chrome extension that involves sending data requests from a popup script to a content script (via a background script), analyzing the request on the content script, and then sending back a response (again through the bac ...

Issue with variable not being properly updated during each iteration - JQuery

$(".room").each(function () { i = i + 1; alert(i); roomid = $(this).attr("id"); alert(roomid); $.get("QueryRoom.aspx?ID=" + roomid, function (data) { $("#" + roomid).html(data); }); }); }); I am facing an issue where the ...

Ways to embed an HTML file into another HTML document

I have been attempting to include a footer.htm file in my index.htm document without success. Below is the code I am using. index.htm <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.d ...

What is the best approach for choosing unquoted HTML attribute values?

I have a unique situation where I am dynamically appending a select element to a form from a hidden field, with escaped spaces in the element content. This is the hidden field content: <input type="hidden" id="field1" name="field1" value="<select i ...

The problem lies in the incorrect rewriting of static resources leading them to be redirected to the

I am currently facing an issue with rewriting URLs. It seems that the problem lies in the redirection of certain URLs to index.php?route=scores, etc. http://www.example.com/scores http://www.example.com/registreren http://www.example.com/login This redir ...

What is the best way to update a targeted component in React when triggered by an event handler?

Your goal may seem straightforward, but getting a reference to a specific component using this is proving to be tricky. Here we have our App.js file: import React, { Component } from 'react'; import CoolBox from './coolBox.js'; import ...

Adjust the color of the entire modal

I'm working with a react native modal and encountering an issue where the backgroundColor I apply is only showing at the top of the modal. How can I ensure that the color fills the entire modal view? Any suggestions on how to fix this problem and mak ...

What is the reason for jsHint's caution: '(var) is declared but not utilized'?

Currently, I am utilizing CodeKit to execute jsHint on my scripts and condense them. I am encountering an error that I would like some clarification on: // create a next button for each text input and wire it for nextQ()! var next = $('<a ...

I attempted to log the elements of my submit button form, but unfortunately nothing is appearing in the browser console

I am attempting to capture the data from my submit button form, but for some reason, nothing is showing up in the console of my browser. $("#signupform").submit(function(event){ // Stopped default PHP processing event.preve ...

exercise on json result

Hello everyone, I have encountered the following output: ["images\/zara\/shoes\/thumbnail\/1.png","images\/zara\/shoes\/thumbnail\/2.png"] using this code snippet: $imgurl=array(); $i=0; if(mysql_num_rows($result) ...

The val() function in jQuery returns an empty string when used with a bootstrap popover input field

I'm facing an issue with my bootstrap popup form that includes input fields and a submit button. The problem arises when I try to capture the current value of the input fields using jQuery's val() method after clicking the submit button - it retu ...

Ascending to the Peak within a div

<script type="text/javascript"> $(document).ready(function(){ updateContent(); }); function updateContent(){ $('#mainDiv').load('home.php', function(){ scrollToTop(); }); } ...

Why isn't my Jquery click event able to download the csv file?

Initially, I was able to export a csv file using the html onclick element. However, when I switched to a jquery click event, the functionality stopped working. I don't understand why, as I believe the same function is being called. The Export.Expor ...

Looking to display user data within a specific div using JavaScript? Check out my code!

Issue Solved by Me I resolved the problem by using ko.js to check data binding in java! Thanks to everyone who helped. I have implemented this code to display online users in my chat application (x7chat 3, available for free download) The code can be fou ...

GTM - monitoring the most recent clicked element's input data

Custom Script function() { var inputs = document.getElementsByTagName("input"), selectedRadios = []; for (var i = 0;i < inputs.length;i++) { if(inputs[i].type==="checkbox" && inputs[i].checked) { selectedRadios.push(inputs[i].value); ...

Chrome and Internet Explorer are not prompting to save passwords after the input type has been altered by a script

I've encountered an issue with a form that includes: <input type="password" id="password" /> I want to display some readable text temporarily, so I used the following code: $('#password').prop('type', 'text'); ...