Like button jQuery

Size
3,469 Kb
Views
10,120

How do I make an like button jquery?

What is a like button jquery? How do you make a like button jquery? This script and codes were developed by Mohammed Fawzy on 26 January 2023, Thursday.

Like button jQuery Previews

Like button jQuery - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>like button jQuery</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="like-social">	<div class="open_video_likes"> <button class="myButton">Like!</button> </div> <!--end open_video_likes button-->	<div class="open_video_likes_div"> <span class="open_video_likes_count"> 20
</span> <i class="fa fa-heart-o" aria-hidden="true"></i> </div> <!-- open_video_likes_div--> </div> <!--end like-social--> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Like button jQuery - Script Codes CSS Codes

.like-social { margin-bottom: 20px; text-align: center;
}
.like-social .open_video_likes { margin: 40px;
}
.like-social .myButton { -moz-box-shadow: 3px 4px 0px 0px #8a2a21; -webkit-box-shadow: 3px 4px 0px 0px #8a2a21; box-shadow: 3px 4px 0px 0px #8a2a21; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #c62d1f), color-stop(1, #f24437)); background: -moz-linear-gradient(top, #c62d1f 5%, #f24437 100%); background: -webkit-linear-gradient(top, #c62d1f 5%, #f24437 100%); background: -o-linear-gradient(top, #c62d1f 5%, #f24437 100%); background: -ms-linear-gradient(top, #c62d1f 5%, #f24437 100%); background: linear-gradient(to bottom, #c62d1f 5%, #f24437 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#c62d1f', endColorstr='#f24437',GradientType=0); background-color: #c62d1f; -moz-border-radius: 18px; -webkit-border-radius: 18px; border-radius: 18px; border: 1px solid #d02718; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 17px; padding: 7px 25px; text-decoration: none; text-shadow: 0px 1px 0px #810e05; outline: none; width: 100px;
}
.like-social .myButton:hover { background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f24437), color-stop(1, #c62d1f)); background: -moz-linear-gradient(top, #f24437 5%, #c62d1f 100%); background: -webkit-linear-gradient(top, #f24437 5%, #c62d1f 100%); background: -o-linear-gradient(top, #f24437 5%, #c62d1f 100%); background: -ms-linear-gradient(top, #f24437 5%, #c62d1f 100%); background: linear-gradient(to bottom, #f24437 5%, #c62d1f 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24437', endColorstr='#c62d1f',GradientType=0); background-color: #f24437; outline: none;
}
.like-social .myButton:active { position: relative; top: 1px; outline: none;
}
.like-social .open_video_likes_div { width: 25%; margin: auto; background-color: #da382a; padding: 10px; box-shadow: 0px 4px 14px; font-size: 22px; font-weight: bolder; color: snow;
}
.like-social .open_video_likes_div i { font-size: 16px; vertical-align: super;
}

Like button jQuery - Script Codes JS Codes

var likes = $('.open_video_likes_count'); // global var
(function addLikes() {
if ( !likes.hasClass('liked') ) { // if there is no 'liked' class $('button').text('Like!'); // change button text to "like!" $('.open_video_likes').one("click",function() { // if he clike like likes.text( +likes.text() + 1 ).addClass('liked'); // convert the .text "String" to integer ( by using +likes or you can use "parseint " or use likes * 1 ) and add one number to it's value addLikes(); // call the function to repeat the process });
} // end if else { // else > there is 'liked' class $('button').text('Unlike!'); // change button text to "unlike!" $('.open_video_likes').one("click",function() { ; likes.text( likes.text() - 1 ).removeClass('liked'); // remove one number from it's value addLikes(); // call the function to repeat the process }); } // end else
}()); // end the function
Like button jQuery - Script Codes
Like button jQuery - Script Codes
Home Page Home
Developer Mohammed Fawzy
Username mohammed-fawzy
Uploaded January 26, 2023
Rating 3
Size 3,469 Kb
Views 10,120
Do you need developer help for Like button jQuery?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Mohammed Fawzy (mohammed-fawzy) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!