A modern, interactive web application that demonstrates synchronized ball movement across multiple browser tabs. When you open this page in multiple tabs and position the windows close to each other, the balls will automatically synchronize and move to the edges, creating a fascinating visual effect.
You can check out the demo at this link:
https://multi-tab-effect.vercel.app/
Open two windows from this address, resize them so there is some space between them, and then bring them close to each other to see the magic happen.
- Cross-Tab Synchronization: Balls automatically sync between multiple browser windows
- Smart Positioning: Balls move to edges when windows are positioned close together
- Modern Visual Effects: Gradient backgrounds, glow effects, and smooth animations
- Responsive Design: Works perfectly on desktop and mobile devices
- Interactive Controls: Click anywhere to reset ball position
- Real-time Communication: Uses localStorage for seamless cross-tab communication
- Modern UI Framework: Built with Tailwind CSS for rapid development
- Open Multiple Tabs: Open
index.htmlin several browser tabs - Position Windows: Arrange the browser windows close to each other
- Watch the Magic: Observe how the balls automatically synchronize and move to the edges
- Interact: Click anywhere on the screen to reset the ball to the center
- Frontend: HTML5, Tailwind CSS, and JavaScript (ES6+)
- Styling: Tailwind CSS via CDN for modern utility-first styling
- Communication: localStorage API for cross-tab synchronization
- Graphics: HTML5 Canvas for smooth animations
- Responsive: Mobile-first design with Tailwind's responsive utilities
- Clean, semantic HTML structure
- Tailwind CSS classes for modern styling
- Glassmorphism effects with backdrop blur
- Responsive design with utility classes
- Proper meta tags for SEO and mobile optimization
- Object-oriented JavaScript using ES6 classes
- Smooth easing animations
- Real-time window position detection
- Dynamic ball positioning algorithms
- Interactive event handling
- Gradient Background: Beautiful purple-to-blue gradient with overlay effects
- Glow Effects: Balls emit light when synchronizing
- Pulse Animation: Subtle breathing effect on the balls
- Smooth Movement: Easing functions for natural ball motion
- Glassmorphism UI: Modern instruction overlay with blur effects
- Tailwind Styling: Utility-first CSS framework for rapid development
- ✅ Chrome/Chromium (recommended)
- ✅ Firefox
- ✅ Safari
- ✅ Edge
⚠️ Internet Explorer (not supported)
- Clone or download this repository
- Open
index.htmlin your web browser - Open the same file in multiple tabs
- Enjoy the synchronized effect!
- Each window generates a unique ID
- Window positions are broadcast via localStorage every 100ms
- When windows detect each other within 100px threshold:
- Balls move to the nearest edge
- Vertical positions are coordinated
- Glow effects are activated
// Calculate window boundaries
const myLeft = window.screenX;
const myRight = window.screenX + window.outerWidth;
const threshold = 100;
// Check for proximity
if (Math.abs(myRight - otherLeft) < threshold) {
// Move ball to right edge
}Modify the gradient in the <style> section of index.html:
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);Customize the UI by modifying Tailwind classes in index.html:
<!-- Example: Change background opacity -->
<div class="bg-white/10"> <!-- 10% opacity -->
<div class="bg-white/20"> <!-- 20% opacity -->
<!-- Example: Change border radius -->
<div class="rounded-2xl"> <!-- Large radius -->
<div class="rounded-3xl"> <!-- Extra large radius -->Adjust ball settings in script.js:
this.ball = {
r: 30, // Radius
color: '#00ffff', // Color
glow: 0, // Glow intensity
pulse: 0 // Pulse animation
};Change the easing factor:
const easing = 0.08; // Lower = slower, Higher = faster- Glassmorphism:
bg-white/10 backdrop-blur-lg - Gradients:
bg-gradient-to-r from-cyan-400 to-pink-400 - Transitions:
transition-all duration-300 - Hover Effects:
hover:-translate-y-1 hover:translate-x-1 - Responsive Design: Built-in responsive utilities
- Modern Shadows:
shadow-2xl shadow-3xl
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
- HTML5 Canvas API for smooth graphics
- localStorage API for cross-tab communication
- Tailwind CSS for modern utility-first styling
- ES6+ JavaScript for clean, maintainable code
If you have any questions or suggestions, feel free to open an issue or contact the developer.
Fariborz
- 🌐 Website: fariborzz.ir
- 💼 LinkedIn: fariborzamm
- 🔗 GitHub: fariborz0015
Built with ❤️ for better user experience
⭐ Star this repository if you found it helpful!