Image tiling
How do I make an image tiling?
What is a image tiling? How do you make a image tiling? This script and codes were developed by Corinne Winthrop on 08 October 2022, Saturday.
Image tiling - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Image tiling</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="sliced"> <img src="https://images.pexels.com/photos/60224/pexels-photo-60224.jpeg?w=940&h=650&auto=compress&cs=tinysrgb" height="400px" width="640px"/>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Image tiling - Script Codes CSS Codes
.sliced{ position: relative; margin: 2em auto;
}
.tile{ float: left;
/* margin: 1px; */
}
Image tiling - Script Codes JS Codes
var imageSlice = function(){ var _defaults = { x : 2, // number of tiles, x axis y : 2, // number of tiles, y axis }; $.fn.sliced = function( options ) { var o = $.extend( {}, _defaults, options ); return this.each(function() { var $container = $(this); // cache this // Code here var width = $container.width(), height = $container.height(), $img = $container.find('img'), n_tiles = o.x * o.y, // total number of tiles tiles = [], $tiles; for ( var i = 0; i < n_tiles; i++ ) { tiles.push('<div class="tile"/>'); } $tiles = $( tiles.join('') ); // Hide original image and insert tiles in DOM $img.hide().after( $tiles ); $tiles.css({ width: width / o.x, height: height / o.y, backgroundImage: 'url('+ $img.attr('src') +')' }); // Adjust position $tiles.each(function() { var pos = $(this).position(); $(this).css( 'backgroundPosition', -pos.left +'px '+ -pos.top +'px' ); }); }); };
};
jQuery(function($){ imageSlice(); $('.sliced').sliced({ x:4, y:4 }); // disabled right click $('.sliced').bind('contextmenu', function(e){ return false; });
});
![Image tiling - Script Codes](http://shots.codepen.io/cwint/pen/rjGRVw-512.jpg)
Developer | Corinne Winthrop |
Username | cwint |
Uploaded | October 08, 2022 |
Rating | 3 |
Size | 2,261 Kb |
Views | 16,192 |
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 |
Pinned scrolling sections | 4,467 Kb |
Responsive image sizes | 8,131 Kb |
Cat vs Mouse | 2,435 Kb |
Animated SVG sequence | 12,723 Kb |
Crazy Cat Lady Application | 4,404 Kb |
Another animated SVG sequence | 6,864 Kb |
Responsive Image Tiling | 2,264 Kb |
Google map with toggle categories | 32,056 Kb |
Zenman Front-End Dev interview homework | 3,030 Kb |
Email obfuscation test | 3,078 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 |
A Pen by Eka Risyana | Risyana | 3,705 Kb |
Light Switch | Bartuc | 4,933 Kb |
Drawing a Terminal with CSS | Lachlanjc | 3,185 Kb |
Filter inputs | Rowinf | 1,721 Kb |
Sidebar Thing | Jonambas | 2,779 Kb |
Rrremark.com Overlay Highlighter | Derickruiz | 4,438 Kb |
Pomodoro Clock | Osycon | 3,705 Kb |
CSS3 keyframe onload animation. | Samueljseay | 1,706 Kb |
Gulpfile | Aimhigherwebdesign-amy | 1,765 Kb |
Canvas snow | Win7killer | 2,572 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!