The sole focus is on the animation within the div

Is it possible to have a circle animation within a button without overlapping it?

Check out my code on this fiddle.

$(document).ready(function(){

        $('button').on("mouseup",function(){
            $('#mousemark').removeClass("click");
        });

        $('button').on('click', function(e){
            $('#mousemark').css({
               left:  e.pageX,
               top:  e.pageY
            });
            $('#mousemark').addClass("click");
        });

    })

Answer №1

To ensure the button is displayed correctly, simply include position:relative and overflow:hidden:

View the DEMO

button {
    width:400px;
    height:200px;
    margin:40px;
    background-color:red;
    position:relative;
    overflow:hidden;
}

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

Choosing versatility over specificity when dealing with web API routes

Hey there! I'm a beginner when it comes to web API routes and I've encountered an issue where my call is choosing the more general route instead of the specific one. The AJAX call I am using is: $.getJSON("/api/solutions/GetSolutionByCategory ...

Using HTML and CSS to create interactive icons that change color when clicked, similar to how a link behaves

Have you ever wondered if there's a way to make an icon act like a link when clicked, just like regular text links turning purple? And not just the last one clicked, but every single icon that gets clicked. Trying to use the :visited pseudo was unsucc ...

PHP code for retrieving all combobox values from a form during submission

When I submit the form, I am only able to retrieve the value of the last combo box. Is there a way to capture all the combo boxes' values? Also, I need to know how to access the value of a label. Below is the code snippet used to generate the list of ...

Navigate div containers interchangeably

Take a look at what I made: https://jsfiddle.net/1qsoL695/ This is the HTML code: <div class="container"> <div id="select"> <div>ONE</div> <div>TWO</div> <div>THREE</div> &l ...

Maximizing Bootstrap card size in Angular4: A step-by-step guide

How can I make Bootstrap cards resizable on top of other elements when clicked on an icon to make it full screen and overlay on other cards? detail.component.html <div class="card card-outline-info" > <div class="card-header bg-info"><h5 ...

Can you explain the distinction between div and span tags?

HTML includes two main tags, div and span. I am curious about the specific functions and roles of each tag. I have experimented with both but haven't been able to identify any significant differences. Can someone provide a detailed explanation on the ...

Jquery Ajax Polling keeps scrolling to the top with each request

Currently, I am using the following function to display the active game list. However, I encounter an issue where if a player is scrolling through the list and triggers an ajax call, the page jumps to the top of the div which gets replaced by the response ...

"Combining the CakePHP media plugin with the dynamic functionality of the jQuery File

MY SITUATION: In the midst of my Cakephp project, I've been utilizing David Persson's media plugin alongside the jQuery Fileuploader plugin based on this tutorial, which has proven to be quite effective. The complication arises in that I requir ...

What is the best way to eliminate duplicate members from an array of objects by comparing their property values?

The array appears as follows: let example = [ { Time: new Date(1000), psi:100.0 }, { Time: new Date(1000), psi:200.0 }, { Time: new Date( ...

Understanding the technique of extracting text from descendant nodes using Xpath

I am facing a scenario similar to this: <div id="m0"> ... <tr> <td></td> <td></td> <td>Radio</td> </tr> </div> <div id="m1"> ... <tr> <td></td> <td>< ...

What is the best way to remove table cells from a TableBody?

Currently, I am in the process of designing a table to display data retrieved from my backend server. To accomplish this, I have opted to utilize the Table component provided by Material UI. The data I retrieve may either be empty or contain an object. My ...

Incorporating ASP includes within an HTML file

Is there a method to utilize ASP or ASP.NET for including HTML in another HTML file, similar to PHP includes with HTML and the AddType handler in .htaccess? I am exploring options for updating navigation on a Windows server that does not have PHP installe ...

transferring a delicious cookie to the browser

I have successfully integrated a basic login system using angular, express, and passport.js into an existing project by following the file structure and coding standards provided in angular-passport. Currently, users can sign up and log in without any iss ...

Update the picture dynamically when hovering

Is there a way to change an image randomly when hovering over it? The hover effect is working fine, but the image does not revert back when the mouse moves out. Any suggestions on how to fix this? var arr = ["020", "053", "306", "035", "930"]; function ...

Stopping a velocity.js animation once it has completed: is it possible?

For the pulsating effect I'm creating using velocity.js as a fallback for IE9, refer to box2 for CSS animation. If the mouse leaves the box before the animation is complete (wait until pulse expands and then move out), the pulsating element remains vi ...

The second attempt at an AJAX call is unsuccessful

I am currently developing a form that displays database results based on two entries: Automarke (brand) and Modell (model). You can view the entries here. The Modell dropdown dynamically changes based on the selected Automarke. Here is the code snippet I ...

What steps can I take to ensure that WebStorm properly recognizes a package's functions?

No matter what I do, WebStorm refuses to stop throwing inspection warnings when I try to use the JOI package in my node.js project. The code runs fine and there are no runtime errors, but the warning persists. I have updated the package, explicitly install ...

Placing a dropdown menu on top of an image

I currently have a slightly rotated menu bar with two buttons as an example: https://i.stack.imgur.com/0sI2P.jpg Due to the rotation, normal HTML handling is not feasible. I am considering using a <map> element to create hyperlinks over the menu it ...

Refreshing a component using a sibling component in React

Currently, I am delving into the realm of React and embarking on a journey to create a ToDo App. However, I've hit a snag while attempting to add a new task to the list. Despite successfully adding an item to the list upon clicking the add button, upd ...

Navigating through paginated data can be made easier by using Backbone.PageableCollection in conjunction with a personalized

I have developed an application that interacts with a database known as LeanCloud. Currently, I have configured a page to display all the users stored in the database. However, LeanCloud has a limitation where only 100 pieces of data can be retrieved per r ...