Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .ctn
  .holder
    each val in ['1', '2','3', '4','5', '6']
      .box
        img(src="https://unsplash.it/60"+val, alt="").img-holder
        
.img-travel
  img(src="https://unsplash.it/603", alt="").img-travel__img
  
  
              
            
!

CSS

              
                
body
  margin: 0
  background: #000000


.ctn
  width: 100%
  height: 100%
  position: fixed
  left: 0
  top: 0
  
  .holder  
    display: flex
    justify-content: center
    width: 300vw
    height: 100%
    opacity: 0.2
    
  .box
    display: flex
    flex-direction: column
    justify-content: center
    align-items: center
    width: 100vw
    height: 100vh
      
    
  


img
  height: 45vh
  width: 99%
  object-fit: cover

.img-travel
  
  &__img
    top: 15vh
    position: fixed
    left: 0vw
    //transform: translate(-50%, -50%)
    height: 70vh
    cursor: pointer
    width: 100vw
    opacity: 0.8


              
            
!

JS

              
                var winW = window.innerWidth;
var $holder = $('.holder');


Draggable.create($holder , {
  trigger: '.ctn',
  type:'x',  
  edgeResistance: .8,
  bounds:'.ctn',    
  throwProps:true
})


var cloned; //var 
let travelHolder = $(window).width()/2
$('.img-travel img').click(function () {

  TweenMax.to($holder, .1,{x: - (travelHolder * 1.5), onComplete: function(){
      let posX = $('img').eq(2).offset().left, //get distancia da lateral da página
        posY = ($('img').eq(2).offset().top) - $(window).scrollTop(), //get distancia do topo do documento e subtrai distancia do topo da janela
        heightClicked = $('img').eq(1).height(), //get tamanho do elemento
        widthClicked = $('img').eq(1).width();//get tamanho do elemento
    TweenMax.to('.img-travel img', 1.2, { left: posX, top: posY, height: heightClicked, width: widthClicked, xPercent: 0, yPercent: 0, ease: Expo.easeInOut }) //attr os elementos das variaveis
    
  }})

});
              
            
!
999px

Console