Adjusting images correctly and enlarging on hover

Currently, I am facing two challenges that I need assistance with. Firstly, I am struggling to properly fit my images in a way that allows the person in the picture to be visible while still filling the entire screen. Secondly, I am looking for guidance on setting up a transform function that will turn text purple and zoom in and out an image behind it when hovering over a button. Below is the code snippet I am currently working with:

Code Snippet:

HTML:


<!doctype html>
<html lang="en" class="h-100">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
    <meta name="generator" content="Hugo 0.98.0">
    <title>StudioPick</title>

    <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f4d40405b5c5b5d4e5f6f1a011d011f024d4a5b4e1e">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">

    <link href="CSS/profileselect.css" rel="stylesheet">


  </head>
  <body class="d-flex h-100 text-center text-white">
    

    <!---Navbar--->
      <header>
        <nav class="navbar navbar-expand-lg navbar-light">
          <div class="container-fluid">
            <a style="font-size: 45px; color: #ffffff;" class="navbar-brand" href="#">
              <strong>StudioPick</a>
              <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
              </button>
              <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
                  <li class="nav-item">
                    <a class="nav-link active" style="color: #ffffff;" aria-curresnt="page" href="index.html">Home</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" style="color: #ffffff;" href="login.html">Log In</a>
                  </li>
                  <li class="nav-item2">
                    <a class="nav-link" href="signup.html">Sign Up</a>
                  </li>
                </ul>
              </div>
          </div>
        </nav>
      </header>
    <!---Navbar--->

    <!---Hero--->
    <div class="split left">
        <div class="centered">
          <button class="profileselect">STUDIO</button>
        </div>
    </div>
      
    <div class="split right">
        <div class="centered">
            <button class="profileselect">ARTIST</button>
        </div>
    </div>
    <!---Hero--->
      


      <footer class="mt-auto text-white-50" id="footer">
        <p>@Bekaedo <br>StudioPick 2022 ©</p>
      </footer>
    </div>

    <script src="Javascript/hover.js"></script>

  </body>
</html>


CSS:


body {
    font-family: Arial;
    color: white;
}
.navbar-light {
  background-color: transparent;
  z-index: 20;
}
.navbar-nav{
  justify-content: space-between;
  
}
.navbar-brand {
  font-size: 35px;
}
.nav-item{
  color: #686868 !important;
  font-size: 20px;
  padding-right: 15px;
}
.nav-item2{
  background-color: #9370DB !important;
  border-radius: 15px !important;
  width: 95px !important;
  text-align: center !important;
  font-size: 20px;
}
#navbarSupportedContent{
  position: relative;
  right: -1375px;
}



.split {
    height: 100%;
    width: 50%;
    position: fixed;
    z-index: 0;
    top: 0;
    overflow-x: hidden;
    padding-top: 20px;
    transition: all 0.3s ease-in-out;
}

.left {
    left: 0;
    background-image: url('../Images/kennybeats-stu.jpeg')
}

.right {
    right: 0;
    background-image: url('../Images/uzi-performing.jpeg')
}


.centered button {
    font-size: 50px !important;
    color: #ffffff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 5px;
    background-color: #000000 !important;
    text-align: center !important;
}

.left :hover {
    background-size: 150%;
}

Javascript:


$(document).ready(function() {

    $('.split').mouseover(function() {

        $(this).find('.profileselect').css('transform', 'scale(1.2)');
    });

    $('.split').mouseout(function() {

        $(this).find('.profileselect').css('transform', 'scale(1)');
    });
});

Thank you for your help!

Answer №1

After making some adjustments to the styling and implementing the JavaScript code, I also incorporated the jQuery script, which is now functioning flawlessly.

$(".profileselect").on("mouseover", function () {
      $(this).parent().parent().addClass("hovered")
    })
    $(".profileselect").on("mouseout", function () {
      $(this).parent().parent().removeClass("hovered")
    })
body {
      font-family: Arial;
      color: white;
    }

    .navbar-light {
      background-color: transparent;
      z-index: 20;
    }

    (...)
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d0ddddc6c1c6c0d3c2f2879c809c829fd0d7c6d383">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

<!---Navbar--->
(...)

Answer №2

Ensure Images are Displayed Correctly:

.right, .left { 
      background-size: cover; 
}

Just a heads up, you used navbar-expand-lg which may be causing the header to display incorrectly. It might be worth removing it and checking again.

Answer №3

give this a shot

.right, .left { 
      background-size: contain; 
}

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

Login system - automatically redirect user to new page after submitting credentials

After successfully opening index.html, when I click the submit button on the login page, I want it to redirect to another page for validation and display a success message there. The current URL of the login page is: http://localhost:51499/index.html Wh ...

Adding values to a knockout data table without refreshing the page

I am currently experiencing difficulties with refreshing my knockout.js DataTable. I have a data table that loads correctly on page load using the attached function method. I also have multiple buttons (Display All, Allowed, Not Allowed) that display the t ...

Discovering the source of the parent link within html.tpl.php

Is there a way to determine the parent page title within html.tpl.php? I need this information to change the background image based on the selected parent link. Here is the URL for reference: Thank you, Ron I couldn't find a solution to this problem ...

Having trouble with animating the background color of an input button using jQuery?

I'm completely confused as to why the background color isn't changing despite investing a significant amount of time into it: <input type="button" class="front-consultation-btn" value="Get A Free Consultation"> <script> $(' ...

I am unsure of the timestamp format for the value 1522899000000. Can it be used in both Ionic and AngularJS? And how would one go

While parsing a JSON from an external URL, I came across a timestamp with the value starttime: 1522899000000 (on 4/5/2018 -> 5th April 2018). The value seemed like a Unix timestamp, but when I tried to convert it, it displayed the year 1912. What kind o ...

Show data on television

My workplace recently acquired a few TVs that we plan to use as display screens for project-related information such as schedules, TO DO lists from web apps like Buildertrend, and accounting crystal reports in the form of dashboards or direct crystal repor ...

The parameter '{ validator: any; }' cannot be assigned to the ValidatorFn type in this context

I am currently experiencing a challenge while attempting to create a custom validator using Angular. I have created a form for my sign-up page and wanted to ensure that the password and confirm password fields match by implementing a custom validator. Des ...

Activate Bootstrap tooltip when input element is focused, and then when the next input element is selected

I'm trying to activate a tooltip on an input element within a table. My goal is to trigger the tooltip when either that specific input element or the adjacent input element in the table are focused. Below is the HTML structure: <td class="fea ...

Leverage scope variables and dynamic CSS properties when using ngClass

Is there a way to manipulate the CSS dynamically in HTML using a scope variable? <div ng-class="myClassScope, { 'dynamic-class': !ifIsNot }"> ...

Asynchronously retrieving data in .NET using Angular

Initially, I am attempting to retrieve all projects from the database based on the provided userId from the URL. This operation is performed in the ngOnInit() lifecycle hook. Each project contains a field named Languages, which represents a list of objec ...

Change the text in a CSS checkbox label when it is selected

There is an innovative Pure-CSS accordion that caught my eye, but I have a unique feature in mind that I would like to incorporate. What I am looking for is the ability for the labels to dynamically change based on the state of the checkboxes without relyi ...

Utilize TypeScript to access a function from a different module

Currently in the process of migrating a Nodejs project from JavaScript to TypeScript, I encountered an error that was not present when using JavaScript. The issue arises when attempting to access functions defined in a separate module from another module, ...

Exploring the functionalities of AngularJS' ng-options when working with select elements

In my search through other posts, I came across this issue but couldn't find a solution. Here is the array in question: $scope.items = [ {ID: '000001', Title: 'Chicago'}, {ID: '000002', Title: 'New York' ...

Implementing specific conditions for the "data-column-id" attribute in a Bootstrap table

Is it possible to apply conditions on the data-column-id attribute, which is fetched from PHP code? if(data-column-id)==0{ data-column-id="ordinary"; } else { data-column-id="ordinary"; }// i want this for cat_type Table <table id="categories ...

Changing the height of tablerows in Material UI v5: A step-by-step guide

I am attempting to adjust the height of the rows in this material-ui code example. import * as React from "react"; import { styled } from "@mui/material/styles"; import Table from "@mui/material/Table"; import ...

What is the best way to stretch an image across the entire screen using Bootstrap?

I attempted to embed the image inside a jumbotron and a container, but unfortunately, my latest attempt did not produce the desired result. Here's the code snippet that I tried: <div class="row"> <div class="full-width-div"> <div ...

What are the steps to designing customizable drop-down content menus on websites?

I am looking to implement a feature where I can create content drop-down bars similar to the ones shown in the images. When a user clicks on the bar, the content should be displayed, and if clicked again, the drop-down should hide. I have searched for a so ...

What is the best way to center a CSS arrow vertically within a table cell?

I'm having trouble with aligning a CSS arrow next to some text inside a table cell... <td><div class="arrow-up"></div> + 1492.46</td> My goal is to have the arrow positioned to the left of the text and centered vertically wit ...

JavaScript: change array objects into a string separated by dots

Task: Converting Nested Objects in an Array to Dot Notation String Using JavaScript Here is a sample data structure that needs to be converted: [ { property: 'name', children: [], message: 'name should not be empty', } ...

Troubleshooting Alignment Problem of Maximize and Close Icons in RadWindow Using ASP.Net

Currently, I am utilizing telerik radwindow to showcase a PDF document. The window seems to be functioning correctly, but there is an issue with the alignment of the maximize and close icons. Ideally, they should appear in the same row, however, they are b ...