Mosaic transition effect between two photos using jQuery
How do I make an mosaic transition effect between two photos using jquery?
Demo of a mosaic transition effect between two photos using jQuery (full-text tutorial). What is a mosaic transition effect between two photos using jquery? How do you make a mosaic transition effect between two photos using jquery? This script and codes were developed by Stathis on 02 August 2022, Tuesday.
Mosaic transition effect between two photos using jQuery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Mosaic transition effect between two photos using jQuery</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="mosaic"></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>
Mosaic transition effect between two photos using jQuery - Script Codes CSS Codes
body { background-color: #000; padding: 2%; color: #ccc; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; } a { color: #0CC5DA; text-decoration: none; } a:hover { color: #DCE808; text-decoration: underline; } #mosaic { background-image: url('http://burnmind.com/demos/mosaic/bottom.jpg'); } #mosaic span.hover { float: left; background-image: url('http://burnmind.com/demos/mosaic/top.jpg'); }
Mosaic transition effect between two photos using jQuery - Script Codes JS Codes
$(document).ready(function() { var width = 640; var height = 480; count = 0; elements = new Array(); var el = $('#mosaic'); el.width(width).height(height); var horizontal_pieces = 8; var vertical_pieces = 6; total_pieces = horizontal_pieces * vertical_pieces; var box_width = width / horizontal_pieces; var box_height = height / vertical_pieces; var vertical_position = 0; for (i=0; i<total_pieces; i++) { var tempEl = $('<span class="hover" id="hover-' + i + '"></span>'); var horizontal_position = (i % horizontal_pieces) * box_width; if(i > 0 && i % horizontal_pieces == 0) { vertical_position += box_height; } tempEl.css('background-position', '-' + horizontal_position + 'px -' + vertical_position + 'px'); el.append(tempEl); elements.push(tempEl); } elements = shuffleArray(elements); $('#mosaic .hover').width(box_width).height(box_height); setInterval(toggleDisplay, 100);
});
function toggleDisplay()
{ var tempEl = elements[count]; var opacity = tempEl.css('opacity'); if(opacity == 0) { tempEl.animate({ opacity: 1 }) } else { tempEl.animate({ opacity: 0 }) } count = (count + 1) % total_pieces;
}
/* shuffleArray source: http://stackoverflow.com/questions/2450954/how-to-randomize-a-javascript-array#12646864 */
function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array;
}
Developer | Stathis |
Username | stathisg |
Uploaded | August 02, 2022 |
Rating | 3 |
Size | 2,518 Kb |
Views | 58,696 |
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 |
Large horizontal menu with CSS3 transitions | 3,403 Kb |
Mosaic transition effect between two photos using jQuery | 2,518 Kb |
Large vertical menu with CSS3 transitions | 3,352 Kb |
A slideshow with a blinds transition | 2,923 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 |
Working around OS X Dynamic Scrollbars | Jrjenk | 2,279 Kb |
The Rope | Chribbe | 2,886 Kb |
Simple Login Form | JoshBlackwood | 4,418 Kb |
Hovers with popups | Zacharyolson | 2,380 Kb |
Perspective Origin Demo | Agelber | 3,614 Kb |
Two Element Typeface | Chrisota | 4,942 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
Glitchy Text Effect | Kescoe | 2,208 Kb |
Main page display | BarryKe | 4,562 Kb |
Animating characters with jQuery | 042 | 2,776 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!