<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          3D Folding Panel3D 褶皺效果

          聯(lián)合創(chuàng)作 · 2023-10-02 15:27

          3D Folding Panel 是一款 CSS 轉(zhuǎn)換和 jQuery 提供動(dòng)力的次要內(nèi)容面板。能夠渲染 3D 褶皺效果。支持 IE、Chrome、firefox、Safari、Opera。

          創(chuàng)建結(jié)構(gòu):

          <main class="cd-main">
          	<ul class="cd-gallery">
          		<li class="cd-item">
          			<a href="item-1.html">
          				<div>
          					<h2>Title 1</h2>
          					<p>Lorem ipsum dolor sit amet, consectetur.</p>
          					<b>View More</b>
          				</div>
          			</a>
          		</li>
           
          		<li class="cd-item">
          			<!-- content here -->
          		</li>
           
          		<!-- additional list items here -->
          	</ul> <!-- .cd-gallery -->
          </main> <!-- .cd-main -->
           
          <div class="cd-folding-panel">
          	
          	<div class="fold-left"></div> <!-- this is the left fold -->
          	
          	<div class="fold-right"></div> <!-- this is the right fold -->
          	
          	<div class="cd-fold-content">
          		<!-- content will be loaded using javascript -->
          	</div>
           
          	<a class="cd-close" href="#0"></a>
          </div> <!-- .cd-folding-panel -->

          添加樣式:

          .cd-main {
            overflow-x: hidden;
          }
          .cd-main > * {
            transition: transform 0.5s 0.4s;
          }
          .cd-main.fold-is-open > * {
            /* on mobile - translate .cd-main content to the right when the .cd-folding-panel is open */
            transform: translateX(100%);
            transition: transform 0.5s 0s;
          }
           
          .cd-folding-panel {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            visibility: hidden;
            overflow: hidden;
            transition: visibility 0s 0.9s;
          }
          .cd-folding-panel .fold-left,
          .cd-folding-panel .fold-right {
            /* the :after elements of .fold-left and .fold-right are the 2 fold sides */
            width: 100%;
            height: 100vh;
            overflow: hidden;
            /* enable a 3D-space for children elements */
            perspective: 2000px;
          }
          .cd-folding-panel .fold-right {
            perspective-origin: 0% 50%;
          }
          .cd-folding-panel .fold-left {
            /* on mobile only the right fold side is visible */
            display: none;
          }
          .cd-folding-panel .fold-right::after {
            /* 2 fold sides */
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            transform-origin: right center;
            transform: translateX(-100%) rotateY(-90deg);
            transition: transform 0.5s 0.4s, background-color 0.5s 0.4s;
          }
          .cd-folding-panel.is-open {
            visibility: visible;
            transition: visibility 0s 0s;
          }
          .cd-folding-panel.is-open .fold-right::after {
            transform: translateX(0);
            transition: transform 0.5s 0s, background-color 0.5s 0s;
          }
          @media only screen and (min-width: 1100px) {
            .cd-item {
              width: 50%;
              float: left;
              transition: transform 0.5s 0.4s;
            }
            .fold-is-open .cd-item {
              transition: transform 0.5s 0s;
              transform: translateX(-400px);
            }
            .fold-is-open .cd-item:nth-of-type(2n) {
              transform: translateX(400px);
            }
          }
           
          @media only screen and (min-width: 1100px) {
            .cd-folding-panel {
              left: 50%;
              transform: translateX(-50%);
              width: 800px;
            }
            .cd-folding-panel .fold-left,
            .cd-folding-panel .fold-right {
              width: 50%;
              float: left;
              height: 100%;
            }
            .cd-folding-panel .fold-right {
              /* change perspective-origin so that the 2 fold sides have the same vanishing point */
              perspective-origin: 0% 50%;
            }
            .cd-folding-panel .fold-right::after {
              transform-origin: right center;
              transform: translateX(-100%) rotateY(-90deg);
            }
            .cd-folding-panel .fold-left {
              display: block;
              /* change perspective-origin so that the 2 fold sides have the same vanishing point */
              perspective-origin: 100% 50%;
            }
            .cd-folding-panel .fold-left::after {
              transform-origin: left center;
              transform: translateX(100%) rotateY(90deg);
            }
            .cd-folding-panel.is-open .fold-right::after,
            .cd-folding-panel.is-open .fold-left::after {
              transform: translateX(0);
              transition: transform 0.5s 0s, background-color 0.5s 0s;
            }
          }
          .cd-folding-panel .fold-right {
            perspective-origin: 0% 50%;
          }
          .cd-folding-panel .fold-left {
            perspective-origin: 100% 50%;
          }

          事件處理:

          /* open folding content */
          $('.cd-gallery a').on('click', function(event){
          	event.preventDefault();
          	openItemInfo($(this).attr('href'));
          });
          function openItemInfo(url) {
          	/* check if mobile or desktop */
          	var mq = viewportSize();
          	if( $('.cd-gallery').offset().top > $(window).scrollTop() && mq != 'mobile') {
          		/* if content is visible above the .cd-gallery - scroll before opening the folding panel */
          		$('body,html').animate({
          			'scrollTop': $('.cd-gallery').offset().top
          		}, 100, function(){ 
                     	toggleContent(url, true);
                  }); 
           
          	} else {
          		toggleContent(url, true);
          	}
          }
           
          function toggleContent(url, bool) {
          	if( bool ) {
          		/* load and show new content */
          		$('.cd-fold-content').load(url+' .cd-fold-content > *', function(event){
          			$('body').addClass('overflow-hidden');
          			$('.cd-folding-panel').addClass('is-open');
          			$('.cd-main').addClass('fold-is-open');
          		});
           
          	} else {
          		/* close the folding panel */
          		$('.cd-folding-panel').removeClass('is-open')
          		$('.cd-main').removeClass('fold-is-open');
          		
          		/* ...*/
          	}
          	
          }

          瀏覽 14
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  多毛无码 | 色欧美在线| 成人免费视频久久久 | 色五月婷婷影视 | 日日av影院 |