I believe it's just basic jQuery with parents

I am having trouble figuring out how to move the class .inner separately in the USPs! Can someone please explain how this can be achieved?

Any suggestions on how to solve this issue?

HTML

<div class="usps">
    <div class="dienst">
        <div class="inside">
            <div class="inner">
                <h2>Roofing</h2>
                <div class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Similique, labore.</div>
            </div>
        </div>
        <div class="bottom"></div>
    </div>
</div>
<div class="usps">
    <div class="dienst">
        <div class="inside">
            <div class="inner">
                <h2>Roofing</h2>
                <div class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Similique, labore.</div>
            </div>
        </div>
        <div class="bottom"></div>
    </div>
</div>

jQuery

$('.usps').hover(function(){ 
     $('.inner').toggleClass('up');
     $('.bottom').toggleClass('red');
});

Answer №1

Make sure to target specific elements - in this scenario, it seems like you are looking to locate the .inner and .bottom elements inside the hovered usps element

$('.usps').hover(function(){ 
     $(this).find('.inner').toggleClass('up');
     $(this).find('.bottom').toggleClass('red');
});

Check out the demonstration here: Fiddle

When using the hover function, remember that this refers to the specific usps element being hovered over, allowing you to easily find the inner and bottom elements within that particular usps 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

A guide on passing JSON data to jQuery autocomplete

Hello everyone, I'm looking for assistance on how to integrate this JSON data with the jQuery autocomplete plugin. Being new to jQuery, I am unsure of the steps involved... [{"0":"1","id":"1","1":"Albania","country":"Albania"}, {"0":"2","id":"2","1 ...

Reactjs: When components are reused, conflicts may arise in UI changes

I'm currently working on creating a sample chat room application using reactjs and redux for educational purposes. In this scenario, there will be 3 users and the Message_01 component will be reused 3 times. Below is the code snippet: const Main = Re ...

sliderLighter: keep the slider moving smoothly at a constant speed

I am currently utilizing lightSlider and I want to create a continuous sliding effect with consistent speed. I do not want any stops or pauses between the images, just a smooth and constant movement. Is it possible to achieve this using lightSlider? Or per ...

Upgrading from Vuetify 2 to 3 involves replacing the deprecated styles like .v-application, rounded, and flat with

I need help with upgrading from Vuetify/Vue 2 to Vue 3. I don't have much experience in front-end development, but I am responsible for updating some old code to keep things running smoothly. The migration guide is not very clear and assumes a certain ...

Ways to locate CSS file path within a web browser

Currently, I am focusing on the theme development aspect of Magento2. After compiling the .less file, I noticed that two css files are generated: styles-l.css styles-m.css Despite trying to inspect the element and view the applied CSS in the browser, i ...

Is there an issue with the jQuery ajax function when it comes to sending the RegistrationId to our server?

Beginning to work with the pushNotification service for my Android app, I successfully received a registration ID from the GCM server and attempted to send this ID to our server using a jQuery AJAX function. My intention was to send this ID after the user ...

Viewing information from the database without the need to refresh the page

HTML <textarea>Enter your question here</textarea><button class="askButton">SUBMIT</button> Upon clicking the button, the question is stored in the database using Ajax, jQuery, and Laravel. However, the question only appears after ...

Creative Blueprint

Our company currently operates 3 browser based games with a team of just 4-5 coders. We are looking to enhance the collaboration within our coding team and streamline our processes. Considering the fact that our games are built using a mix of html, php, j ...

Error with Bootstrap Layout caused by the StringBuilder

After diving into Bootstrap, I encountered an issue with the layout generated by a VB.NET page using StringBuilder. The result was a disorganized mess: Upon further inspection, it became evident that the problem extended to other sections of the page as w ...

Error: The function explore() is missing a required parameter called 'path'

Here is my code snippet: def navigate(directory): # To avoid issues with forward slashes, normalize the path directory = os.path.normpath(directory) if os.path.isdir(directory): subprocess.run([FILEBROWSER_PATH, directory]) elif os.path.isfile(directo ...

Modify the body tag upon loading the page for Bootstrap 2.0

I'm currently utilizing bootstrap on my website, and I have implemented scrollspy with bootstrap. However, I am facing an issue where adding scrollspy to other pages causes my links to behave unexpectedly. Is there a way to simply incorporate the foll ...

Obtain the identifier of the draggable target

I'm having trouble finding information on how to retrieve the id of the target using draggable instead of droppable. JS $('.elementDiv').draggable({ stop: function() { var droppedWhere = $('this').next().attr('id&apo ...

Leveraging JQuery for Inserting Data Into mySQL Database

As I delve into JQuery for the first time while working on a project, I realize that this endeavor serves as more of a learning experience rather than a functional one. Currently, I have three PHP files in play: 'connection.php', which establishe ...

Get the latest html content and save it as a .html file using javascript or jQuery

Looking for a way to save an HTML page as a .html file? Having some trouble with jQuery modifications not being included in the exported file? Check out the code snippet below and let me know if you can spot what's going wrong! I'm still getting ...

What is the correct way to implement ::v-deep(<inner-selector>) in a Vue component?

I am attempting to assign an existing style class to a child element that will be loaded using the v-html directive. Since /deep/ and >>> are no longer supported, I have tried using ::v-deep in Vue. <template> <div v-else v-html="chi ...

What could be causing the Php Media Gallery to malfunction?

I am currently working on setting up a video/image gallery to simplify the process of uploading videos/images. This gallery will include thumbnail images of the videos/images along with a brief description. When the thumbnail is clicked, the image/video wi ...

Select element's width decreases by 2 pixels following the application of width adjustment via jQuery

After browsing through numerous pages, I finally managed to adjust the width of my textbox and select element using jQuery 2.0. Snippet of Code from my Project: $(document).ready(function(){ $("#Text2").css('width','20 ...

The mystery of the Accordion Effect: A Next.js/React.js issue where it slides up but refuses to

After implementing a custom accordion using next.js, I encountered an issue where the slide animation worked successfully when moving up and out upon clicking the button. However, when trying to move it back down into the content, it did not animate as exp ...

Error: Django unable to load jQuery library

Hey there! I have a template that includes my JavaScript code. However, when I view the template in a browser, it doesn't provide the interaction I was hoping for. Upon checking the console, I see the following error messages: Error: Bootstrap's ...

Transform the usual button into a jQuery button that requires a press and hold action

Within my code, there are two buttons in play. One button triggers the burger menu, while the second button adjusts the size of a div. I am looking to transform only the second button into a hold button that activates after a 3-second delay. code: $doc ...