JavaScript - Page 4
Drop down menu (jQuery)
Last updated: 10.10.2025
Views: 281
Drop down menu can be done without JavaScript, only with the help of CSS. With :hover. But the JavaScript menu has its advantages. The most important thing is the delay in the disappearance of the drop-down elements.
Let's consider a simple menu with one nesting level. We will write the code using jQuery. Although jQuery is not the most modern tool, this library continues to be used in many pr...
jQuery Accordion Plugin
Last updated: 10.10.2025
Views: 168
An accordion is often used on websites. This element is popular and convenient at the same time. An accordion helps to structure content and save space. In my work, I often used jQuery (and sometimes use it now). And with the help of this library, I wrote an accordion plugin for use in different projects. The plugin is based on the slideToggle() method. Maybe this plugin will also be useful to som...
Simple JavaScript Clock
Last updated: 02.04.2026
Views: 220
There are many examples of implementing a clock using JavaScript, and while the approaches may vary slightly, most of them follow a similar idea. Typically, such functionality is built using timing functions like setTimeout or setInterval, which allow the interface to update the displayed time at regular intervals.
Even though the logic behind a simple clock is not very complex, it is a great p...
jQuery Tabs Plugin
Last updated: 10.10.2025
Views: 170
Tabs are a fairly common element. There are various implementations of this element on the Internet. But often the tabs are overloaded with code filled with effects that are unlikely to be needed in ordinary tasks. Therefore, it was decided to write simple tabs, so to speak, "for myself".
This plugin was written a long time ago and I used it in my work. jQuery is not considered a modern solutio...
How to Create a Custom jQuery Plugin
Last updated: 10.10.2025
Views: 202
The convenience of the jQuery plugin is that you can use the same code several times for different objects. In this case, copy-paste code is not needed. In addition, you can change the behavior of the plugin with different parameters. To write your jQuery plugin, you need to expand the $.fn object
In general, it looks like this:
[js]
$.fn.MyPlugin = function() {
//plugin code
}
[/js]...