Custom Event Policing
How do I make an custom event policing?
Simple function to monitor events firing, and making sure they don't over fire due to user input (people clicking stuff way to fast). What is a custom event policing? How do you make a custom event policing? This script and codes were developed by Adam Grayson on 10 November 2022, Thursday.
Custom Event Policing - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Custom Event Policing</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="btn">Click Me</div>
<h1>Clicking Counter</h1>
<div class="output">0</div>
<h1>Window Resize Counter</h1>
<div class="output">0</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Custom Event Policing - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Lato:400,700);
html, body { background: #2682D5; font: 400 16px/16px "Lato", sans-serif;
}
h1 { margin-top: 50px; font-size: 20px; line-height: 24px; color: #FFFFFF; text-align: center;
}
.btn { width: 100px; padding: 12px 0; border: 1px solid #FFFFFF; color: #FFFFFF; border-radius: 4px; margin: 50px auto 0; text-align: center; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
.btn:hover { border: 1px solid #FFFFFF; color: #2682D5; background: #FFFFFF;
}
.btn:active { opacity: 0.7;
}
.output { width: 100px; padding: 12px 0; background: #FFFFFF; color: #777777; margin: 20px auto; text-align: center;
}
Custom Event Policing - Script Codes JS Codes
(function() { var clickCounter, eventPolice, increaseClickCounter, increaseResizeCounter, policing, resizeCounter; policing = false; clickCounter = 0; resizeCounter = 0; eventPolice = function(func, delayTime) { if (policing) { return; } policing = true; func(); setTimeout(function() { return policing = false; }, delayTime); }; increaseClickCounter = function() { clickCounter++; $('.output').eq(0).text(clickCounter); }; increaseResizeCounter = function() { resizeCounter++; $('.output').eq(1).text(resizeCounter); }; $('.btn').click(function() { eventPolice(increaseClickCounter, 800); }); $(window).resize(function() { eventPolice(increaseResizeCounter, 1000); });
}).call(this);
Developer | Adam Grayson |
Username | agrayson |
Uploaded | November 10, 2022 |
Rating | 4 |
Size | 3,255 Kb |
Views | 6,072 |
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!
Name | Size |
Dynamic circle menus with SASS | 3,928 Kb |
Circle Progression Plugin | 2,612 Kb |
Sliding Lines Animation | 2,572 Kb |
Custom Select Element | 3,616 Kb |
Simple Accordion | 2,952 Kb |
Responsive Carousel | 3,291 Kb |
Responsive square grid in pure CSS | 2,140 Kb |
Spinning Circles | 3,581 Kb |
Drag and Drop File Preview | 3,444 Kb |
Random Weapon Generator | 4,209 Kb |
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!
Name | Username | Size |
Hover Animation from UNIQLO | Insprd | 3,772 Kb |
Front in Aracaju Logo Pure CSS | Shankarcabus | 2,581 Kb |
Responsive Table-less Shopping Cart | Alex_rodrigues | 6,637 Kb |
Polygon Logo in CSS | Kai | 3,412 Kb |
Electric worm | Jeffibacache | 2,377 Kb |
Mobile first social buttons with no iframe | Alistairtweedie | 3,158 Kb |
Spilled Paint | Darrylhuffman | 3,894 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
Basecamp 3 Document | Lachlanjc | 3,811 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!