cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <figure id="multiSlide" class="multiSlide"></figure>
<nav id="multiSlideNav" class="multiSlideNav">
  <a href="#" id="top" class="navButton"><</a>
  <a href="#" id="bottom" class="navButton">></a>
  <a href="#" id="left" class="navButton"><</a>
  <a href="#" id="right" class="navButton">></a>
</nav>
            
          
!
            
              body {
    background: #696969;
    font-family:  'comic sans ms', Helvetica,  arial,  sans-serif;
}

.multiSlide {
    width: 470px;
    height: 470px;
    position: relative;
    margin: 100px auto 0;
    overflow: hidden;
    -webkit-perspective: 300px;
}
.box {
    background: #fff;
    position: absolute;
    top: 10px;
    left: 10px;
    padding:5px;
    width: 140px;
    height: 140px;
    border-radius: 4px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.5),inset 0 -1px 2px 0 rgba(0,0,0,0.3);
    -webkit-transition: all 500ms cubic-bezier(0.7,-0.9,0.3,1.4);
    -moz-transition: all 500ms cubic-bezier(0.7,-0.9,0.3,1.4);
    transition: all 500ms cubic-bezier(0.7,-0.9,0.3,1.4);
    opacity: 1;
}
.box[data-pos='21']{
    -webkit-transform: rotateX(30deg);
    -webkit-transform-origin: center bottom;
    opacity: 0.8;
}
.box[data-pos='23']{
    -webkit-transform: rotateX(-30deg);
    -webkit-transform-origin: center top;
    opacity: 0.8;
}
.box[data-pos='12']{
    -webkit-transform: rotateY(-30deg);
    -webkit-transform-origin: right center;
    opacity: 0.8;
}
.box[data-pos='32']{
    -webkit-transform: rotateY(30deg);
    -webkit-transform-origin: left center;
    opacity: 0.8;
}
.box[data-pos='2-1'],
.box[data-pos='20'],
.box[data-pos='24'],
.box[data-pos='25'],
.box[data-pos='02'],
.box[data-pos='42'],
.box[data-pos='-12'],
.box[data-pos='52']{
    opacity: 0;
}
.box img {
    width: 140px;
    height: 140px;
}

.multiSlideNav {
    width: 470px;
    height: 470px;
    position: absolute;
    left: 50%;
    top: 100px;
    margin: 0 0 0 -235px;
}
.navButton {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #444;
    border-radius: 100%;
    left: 50%;
    top: 50%;
    text-decoration: none;
    line-height: 27px;
    text-align: center;
    color: #888;
    font-size: 22px;
    font-weight: bold;
    -webkit-transition: all 300ms ease;
    -moz-transition: all 300ms ease;
    transition: all 300ms ease;
}
.navButton:hover {
    background: #5f5f5f;
}
.navButton#top {
    -webkit-transform: rotateZ(90deg);
    -moz-transform: rotateZ(90deg);
    -transform: rotateZ(90deg);
    margin: -215px 0 0 -15px;
}
.navButton#bottom {
    -webkit-transform: rotateZ(90deg);
    -moz-transform: rotateZ(90deg);
    -transform: rotateZ(90deg);
    margin: 185px 0 0 -15px;
}
.navButton#left {
    margin: -15px 0 0 -215px;
}
.navButton#right {
    margin: -15px 0 0 185px;
}
            
          
!
            
              window.addEventListener('load',function(){
    figure = document.getElementById('multiSlide');
    topButton       = document.getElementById('top');
    bottomButton    = document.getElementById('bottom');
    leftButton      = document.getElementById('left');
    rightButton     = document.getElementById('right'); 
    
    new Box(-2,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(-1,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(0,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(1,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(3,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(4,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(5,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,-2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,-1,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,0,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,1,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,2,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,3,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,4,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    new Box(2,5,'https://www.technotoday.com.tr/Post/PostDosyalar/image/Haber/2689.jpg');
    
    topButton.addEventListener('click', function(){
        if(slidePosY>-3)
            slide('Y',-1);
    });
    bottomButton.addEventListener('click', function(){
        if(slidePosY<4)
            slide('Y',1);
    });
    leftButton.addEventListener('click', function(){
        if(slidePosX>-3)
            slide('X',-1);
    });
    rightButton.addEventListener('click', function(){
        if(slidePosX<4)
            slide('X',1);
    });
});

var unit            = 160;
var registeredBoxes = [];
var slidePosX       = 0;
var slidePosY       = 0;
var Box = function(posX,posY,img){
    this.pos    = {};
    this.pos.X  = posX;
    this.pos.Y  = posY;
    this.img    = img;
    this.init();
}
Box.prototype = {
    init : function(){
        this.DOMElement             = document.createElement('div');
        this.DOMElement.className   = 'box';
        this.DOMElement.style.left  = (this.pos.X*unit)-unit+'px';
        this.DOMElement.style.top   = (this.pos.Y*unit)-unit+'px';
        this.DOMElement.setAttribute('data-pos',this.pos.X.toString()+this.pos.Y.toString());
        
        var img = document.createElement('img');
        img.src = this.img;
        
        this.DOMElement.appendChild(img);
        figure.appendChild(this.DOMElement);
        registeredBoxes.push(this);
    },
    setPosition : function(axis,val){
        this.pos[axis] = val;
        if(axis == 'X'){
            this.DOMElement.style.left  = (this.pos[axis]*unit)-unit+'px';
        }else if(axis == 'Y'){
            this.DOMElement.style.top   = (this.pos[axis]*unit)-unit+'px';
        }
        this.DOMElement.setAttribute('data-pos',this.pos.X.toString()+this.pos.Y.toString());
    }
}

function slide(axis,dir){
    var len = registeredBoxes.length;
    
    if(axis == 'Y'){
        for(var i=0; i<len; i++){
            if(registeredBoxes[i].pos['X']=='2'){
                registeredBoxes[i].setPosition(axis,registeredBoxes[i].pos['Y']+(1*dir));
            }
        }
        slidePosY = slidePosY+dir;
    }else if(axis == 'X'){
        for(var i=0; i<len; i++){
            if(registeredBoxes[i].pos['Y']=='2'){
                registeredBoxes[i].setPosition(axis,registeredBoxes[i].pos['X']+(1*dir));
            }
        }
        slidePosX = slidePosX+dir;
    }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console