While working on creating a CSS button, I wanted to incorporate the Material Design ripple or wave effect into it. I came across a simple script on codepen that works well by adding the class "ripple" to various elements such as divs, buttons, images, and links. However, I encountered an issue where it would not open the link associated with the button I had created. As someone who isn't very experienced in jQuery or JavaScript, I suspect that this problem might be related to the JS code. The link opens fine when the "ripple" class is removed from the button, but the button fails to function properly in launching the link when the class is added even though the ripple animation works perfectly.
I would appreciate any guidance on resolving this dilemma. You can find the codepen demo I'm using here.
I understand your explanation that it may need to be one or the other, but I'm a bit confused about the best approach. I managed to make the link open in the original or "same" window by eliminating the target="_blank", but I was hoping to retain the target option without both tabs opening the new link if possible.
(function (window, $) {
$(function() {
$('.ripple').on('click', function (event) {
window.location = $(this).attr('href');
/* event.preventDefault(); */
/*HTML Button Code*/
<div class="media__body tagline overtext"><a href="http://www.google.com" class="media-btn-bottom-blue ripple" target="new">Learn More</a></div>