Catslicer
How do I make an catslicer?
What is a catslicer? How do you make a catslicer? This script and codes were developed by Theun on 23 July 2022, Saturday.
Catslicer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Catslicer</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul class="cat-slice"> <li><img src="http://placekitten.com/401/600"/></li> <li><img src="http://placekitten.com/400/600"/></li> <li><img src="http://placekitten.com/402/600"/></li> <li><img src="http://placekitten.com/403/600"/></li> <li><img src="http://placekitten.com/404/600"/></li>
</ul> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Catslicer - Script Codes CSS Codes
.cat-slice { padding: 0; margin: 0; left: 50%; top: 50%;
}
.cat-slice li { list-style-type: none; display: block; height: 600px; width: 400px;
}
Catslicer - Script Codes JS Codes
(function($){ $.fn.extend({ slot: function( params ) { var defaults = { horizontal: true, slots: 20 }; var options = $.extend( defaults, params ); return this.each(function(){ var $context = $(this), $container = $('<div>'), $children = $context.children(), numItems = $children.size(), horizontal = options.horizontal, viewports = [], wrappers = [], height = $children.height(), width = $children.width(), slots = options.slots, stepA = Math.floor(horizontal ? height / slots : width / slots), stepB = horizontal ? width : height; function init() { var $viewport, $wrapper, style, items; // Style children and tag with their index $children.each(function( index ){ style = {}; style[ horizontal ? 'left' : 'top' ] = index * stepB; style.position = 'absolute'; $(this).data('id', index).css( style ); }); for( var i = 0; i < slots; i++ ) { // Create a viewport for this row / col $viewport = $('<div>').addClass('viewport'); // Create an element to hold the items $wrapper = $context.clone(); // Copy the items items = $wrapper.children().remove(); // Shuffle them items = shuffle( items.toArray() ); // Initialise the viewport and wrapper setupItem( $viewport, $wrapper, i ); // Add the items to the wrapper $wrapper.append( items ); // Add the wrapper to the viewport $viewport.append( $wrapper ); // Add the viewport to the container $container.append( $viewport ); // Store a reference to the wrapper and viewport viewports.push( $viewport ); wrappers.push( $wrapper ); } // Append $context.before( $container ).remove(); $container.addClass( 'slot' ); } function setupItem( $viewport, $wrapper, index ) { // Containers for styles var viewportCSS = {}, wrapperCSS = {}; // Set the cropped viewport dimension viewportCSS[ horizontal ? 'height' : 'width' ] = stepA; // Set the full size viewport dimension viewportCSS[ horizontal ? 'width' : 'height' ] = stepB; // Offset the viewport viewportCSS[ horizontal ? 'top' : 'left' ] = stepA * index; // Position it and kill overflow viewportCSS.position = 'absolute'; viewportCSS.overflow = 'hidden'; // Offset the wrapper to compensate for the viewport offset wrapperCSS[ horizontal ? 'top' : 'left' ] = stepA * -index; wrapperCSS.position = 'relative'; // Apply styles $viewport.css( viewportCSS ); $wrapper.css( wrapperCSS ); } function shuffle( arr ) { var shuffled = [], copied = arr.concat(); while( copied.length > 0 ) { shuffled.push( copied.splice( Math.floor(Math.random() * copied.length), 1 )[0] ); } return shuffled; } // Public API this.shuffle = function() { var tween, index, item; for( var i = 0; i < wrappers.length; i++ ) { item = wrappers[i]; index = Math.floor(Math.random() * numItems); tween = {}; tween[ horizontal ? 'left' : 'top' ] = -index * stepB; $(item).stop().animate( tween, { duration: 1200 }); } }; $(this).bind('goto', function( params ){ console.log( 'goto', params ); }); /* this.goto = function( params ) { console.log( 'goto', params ); }; */ // Initialise component init(); }); } });
})(jQuery);
var catSlice = $('.cat-slice').slot({ //horizontal: true, //slots: 3
});
function shuffle() { catSlice.trigger( 'shuffle' );
}
setInterval(shuffle, 2800);
shuffle();
Developer | Theun |
Username | tjoen |
Uploaded | July 23, 2022 |
Rating | 3.5 |
Size | 2,957 Kb |
Views | 48,576 |
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 |
Touch Slider | 3,587 Kb |
Font Awesome Cheetsheet | 7,878 Kb |
Those kids... | 3,390 Kb |
Montyclock | 4,728 Kb |
City block generator | 2,897 Kb |
A Pen by Theun | 6,152 Kb |
D3 example | 2,392 Kb |
A Pen by Theun | 2,240 Kb |
Three.js shooter template | 6,268 Kb |
SVG pong | 3,818 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 |
Freecodecamp - Tribute Page | Samoht513 | 3,583 Kb |
Greyscale image with filter in CSS3 | NickyCDK | 1,562 Kb |
Toolbar | Onsen | 5,414 Kb |
Comment Jquery | SquishyAndroid | 2,421 Kb |
Beautiful canvas stars | Matths | 2,399 Kb |
C.Rowe Button | Brownerd | 2,473 Kb |
Materializecss input form | Jasonchan | 1,443 Kb |
Z-index demo | Kblh | 1,534 Kb |
Google Fonts Sass Mixin | HugoGiraudel | 4,237 Kb |
RWD Conversion Practice | Jxqr97 | 2,743 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!