Smooth Navigational Menu (ddsmoothmenu.js)
A lightweight, cross-browser DHTML menu from Dynamic Drive. It creates sliding submenus with optional shadows and configurable delays.
Ideal for both horizontal site navbars and vertical side menus.
Key Features
- Horizontal & vertical modes: switch via
orientation - Arrow indicators: customizable down/right arrow images
- Slide animations: control in/out durations
- Shadow effects: optional drop shadows for submenus
- Show/hide delays: debounce submenu appearance/disappearance
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
arrowimages |
Object | {down:['downarrowclass','down.gif',23], right:['rightarrowclass','right.gif']} |
CSS class, file & padding for menu arrows |
transition |
{overtime, outtime} |
{overtime:0, outtime:0} |
Milliseconds for slide‐in (overtime) and slide‐out (outtime) animations |
shadow |
{enable, offsetx, offsety} |
{enable:true, offsetx:5, offsety:5} |
Toggle shadows and set x/y offsets |
showhidedelay |
{showdelay, hidedelay} |
{showdelay:0, hidedelay:0} |
Delay before showing/hiding submenus (ms) |
orientation |
"h" or "v" |
"h" |
Menu layout: horizontal or vertical |
classname |
String | "ddsmoothmenu" |
Class added to menu container |
contentsource |
"markup" or [containerID, url] |
"markup" |
Source of menu HTML (inline or AJAX) |
Public API
ddsmoothmenu.init(setting)
Initializes menu on jQuery(document).ready.
setting: object matching above options- Supports inline markup or fetching external menus via AJAX
ddsmoothmenu.init({
mainmenuid: "nav-user",
orientation: 'h',
classname: 'ddsmoothmenu',
contentsource: "markup"
});
ddsmoothmenu.buildmenu($, setting)
Builds structure and event handlers on an existing UL menu.
ddsmoothmenu.getajaxmenu($, setting)
Fetches external menu container via jQuery AJAX, then calls buildmenu.
Responsive Form Validation (bootstrap-validation.js)
Applies Bootstrap’s custom validation styles to all forms upon submission.
document.addEventListener('DOMContentLoaded', function () {
const forms = document.querySelectorAll('form');
Array.prototype.slice.call(forms).forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
});
- 🎯 Purpose: Prevent invalid form submission and highlight fields
- ✅ Bootstrap compatible: adds
.was-validatedfor styling feedback
Base64 Encoding/Decoding Utility (base64.js)
A stand-alone Base64 encoder/decoder with UTF-8 support.
var Base64 = {
codex: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(input) { /* … */ },
decode: function(input) { /* … */ }
};
StringBuffer: efficient string builderUtf8EncodeEnumerator&Base64DecodeEnumerator: handle multi-byte chars- Use case: client-side data embedding, PDF label generation
PDF Label Generation (jsLabel2PDF.js)
Generates PDF output for label printing via HTML5 and JavaScript.
$.CreateTemplate("inches",4,6,0,0,4,6,1,6,0.40,0);
$.CreateLabel();
$.AddText(0.8,0.8,'Test Labels',12);
$.DrawPDF();
- 📄 Stream-based PDF assembly
- 📦 Dependencies:
base64.js,sprintf.js - 🔧 Configurable: units, page size, margins, label grid
Scroll-Aware Navigation (nav-scroll.js)
Hides/shows header on scroll direction for better UX.
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var current = window.pageYOffset;
var el = document.getElementById("hideOnScroll");
if (prevScrollpos < current) el.classList.add("topHide");
else el.classList.remove("topHide");
prevScrollpos = current;
};
- ➡️ Hide header when scrolling down
- ⬅️ Reveal when scrolling up
C-Style String Formatting (sprintf.js)
Implements Perl-style sprintf in JavaScript.
sprintf("%01.2f", 123.1); // "123.10"
sprintf("[%10s]", "monkey"); // "[ monkey]"
- Supports flags:
-+0, width, precision, base conversions (b, o, x) - Useful for PDF table formatting and numeric output
Flash Embedding & Detection (swfobject_modified.js)
A modified SWFObject v2.0 for Flash content embedding with MIT license.
- Browser detection: plugin vs ActiveX checks
- ExpressInstall: fall-back installer for outdated Flash
- API:
swfobject.embedSWF(),swfobject.getFlashPlayerVersion()
No diagrams required – straightforward utility.
Site-Wide JS Behaviors (function.js)
Contains common UI interactions:
- 🔙 Back-to-top button
- 🎬 On-scroll animations (
.animatable→.animated) - 🔄 Responsive reCAPTCHA scaling
- 📱 Mobile field class toggling
- 🧩 Accordion and modal toggles
- 🛞 Slick carousel for customer logos
$('.btn-backTop').on("click", () => $('html, body').animate({scrollTop:0},800));
$(window).on('scroll', doAnimations).trigger('scroll');
$('.accordion-toggle').click(() => $('.mw-collapse').slideToggle());
$('.customer-logos').slick({ slidesToShow:7, autoplay:true });
Integration & Usage
All scripts under linuxfront-v2-logistics/new_2025_js/ are loaded via server config (inc/config.php), ensuring correct order and dependencies. For example, ddsmoothmenu.js is included alongside its CSS in the page header .
Each file is self-contained, leverages jQuery where appropriate, and enhances UX across navigation, forms, data formatting, and media embedding.