carousel-3d : jquery plugin 3D carousel slider
A simple 3D carousel widget. It supports all major browsers including IE8,9 with best effort. Full 3D effect requires css transform3d
support browsers. And this widget works with not only images but any html elements as child.
Supports
- IE8~ (full 3D requires IE10~)
- Chrome(32~)
- Safari(6~)
- Firefox(9~)
- Opera(?~)
- iOS-Safari(ios5~)
- android-browser(?~)
Thanks to Sauce Labs, I confirmed carousel working on above versions. I think I can say it works almost everywhere.
Demo
http://paio-co-kr.github.io/carousel-3d
Installation
bower install carousel-3d
Dependencies
carousel-3d requires some modules. jquery
, javascript-detect-element-resize
, modernizr
, waitForImages
. You will need to include those scripts before carousel-3d.js in html page or load it with requirejs or browserify as carousel-3d comes with UMD style module definition.
Code Example
- Extremely Easy! you don't need to code javascript.
- Adding
data-carousel-3d
attribute ondiv
will be rendered as carousel. - Create items in the
<div data-carousel-3d></div>
tag. All items on that list will be arranged on 3D position. - Items can be simple image or any complicated html elements.
- You can also
selected
attribute on item which will be default selected item.
in header, add css theme and required js.
<link rel="stylesheet" href="../dist/styles/jquery.carousel-3d.default.css" /> <script src="../bower_components/jquery/jquery.js"></script> <script src="../bower_components/javascript-detect-element-resize/jquery.resize.js"></script> <script src="../bower_components/waitForImages/dist/jquery.waitforimages.js"></script> <script src="../bower_components/modernizr/modernizr.js"></script> <script src="../dist/jquery.carousel-3d.js" ></script>
in body
<div id="wrapper"> <div id="myCarousel" data-carousel-3d> <img src="./images/1.jpg" /> <img src="./images/2.jpg" selected /> <img src="./images/3.jpg" /> <img src="./images/4.jpg" /> <img src="./images/5.jpg" /> </div> </div>
- You will also want html document as child. wrap contents with a div.
<div style="min-width: 640px; min-height: 420px; max-width: 640px; max-height: 420px;"> <p style="background-color:black; color:white; margin:20px; padding:20px;">A simple html child</p> <div style="background-color:gray; color:white;">Html contents also works ok!!!</div> <div>The quick brown fox jumps over the lazy dog</div> <p> Make the fox <button type="button" onclick="alert('Jump!!');">jump</button> </p> </div>
The Carousel will have parents 100% width & aspect height. so you will want wrap the div with appropriate size. And wide aspect(3:2, 2:1 ...) is recommanded for 3D rotating effect.
You can have multiple carousels with no effort. Just set proper attribues.
API Reference
- Rotate carousel prev / next
$('#myCarousel').Carousel3d('prev'); $('#myCarousel').Carousel3d('next');
- Rotate carousel by index
$('#myCarousel').Carousel3d('rotate', 3);
- Event listener
$('#myCarousel').on('select', function (evt, index) { console.log('item selected : ' + index); });
History
0.2.2
- removed semi-NSFW image.
- removed wrong js include in example html.
0.2.1
- bug fix : Multiple instances #4
0.2.0
- re-engineer project
0.1.0
- improved transforms
- added theme feature
License
MIT Β© PAIO
μΌλ¬μ -3d : μ μ΄μΏΌλ¦¬ νλ¬κ·ΈμΈ 3D μΌλ¬μ μ¬λΌμ΄λ
μ λ§ κ°λ¨ν 3d μΌλ¬μ
μμ ―μ
λλ€.
css transform3d
μ κ°μ΄ Full 3d ν¨κ³Όλ₯Ό μꡬνλ λΈλΌμ°μ λ€μ μ§μνλ κ²μ λ¬Όλ‘ IE8,9 μμλ μ΅μ μ μ±λ₯μ 보μ΄λλ‘ μ§μν©λλ€. λν κ·Έλ¦Όλ€ λΏλ§ μλλΌ μ΄λ ν HTML elements μ μμμμμμλ μ μλν©λλ€.
μ§μ
- μΈν°λ· μ΅μ€νλ‘λ¬ 8 ~ (Full 3dλ₯Ό μꡬνλ IE10~μ΄μ)
- ν¬λ‘¬(32~)
- μ¬ν리(6~)
- νμ΄μ΄νμ€(9~)
- μ€νλΌ(?~)
- iOS μ¬ν리(ios5~)
- μλλ‘μ΄λ λΈλΌμ°μ (?~)
λ¨Όμ λμμ μ£Όμ Sauce Labsμ κ°μ¬μ λ§μμ μ ν΄λ리며, μμ μΈκΈλ μΈν°λ·λΈλΌμ°μ λ€μ λ²μ μμ μΌλ¬μ -3Dκ° μ μλνλ κ²μ΄ νμΈ λμμ΅λλ€. μ μκ°μλ κ±°μ λͺ¨λ κ³³μμ μ μλνλ€κ³ ν μ μμ΅λλ€.
λ°λͺ¨
http://paio-co-kr.github.io/carousel-3d
μ€μΉ
bower install carousel-3d
μμ‘΄μ±
μΌλ¬μ
-3dλ jquery
, javascript-detect-element-resize
, modernizr
, waitForImages
λ± κ³Ό κ°μ λͺ¨λλ€μ λμμ΄ νμν©λλ€. μ¬λ¬λΆλ€μ΄ μΌλ¬μ
-3d.jsλ₯Ό HTMLνμ΄μ§ μμμ ꡬν νκ±°λ λλ νμν μλ°μ€ν¬λ¦½νΈμ ν¨κ» μ€μ΄ ꡬννκ±°λ, λλ UMD μ€νμΌ λͺ¨λ μ μμ λ°λ₯Έ μΌλ¬μ
-3dλ₯Ό ꡬννκ³ μΆλ€λ©΄ μμ μΈκΈν μ€ν¬λ¦½νΈλ€μ΄ νμ ν κ²μ
λλ€.
μ½λ μμ
- μ λ§ μ¬μμ! μλ°μ€ν¬λ¦½νΈ μ½λλ₯Ό λͺ°λΌλ λ©λλ€.
div
μdata-carousel-3d
μμ±μ μΆκ°νμΈμ. μΌλ¬μ λ‘ λλλ €μ§ κ²μ λλ€.<div data-carousel-3d></div>
νκ·Έμμ μμ΄ν λ€μ λ§λμΈμ. κ·Έ 리μ€νΈμ μμ΄ν λ€μ΄ λͺ¨λ 3D μμΉλ‘ μ‘νμ§ κ²μ λλ€.- κ·Έλ¦Όμ΄λ μ΄λ€ 볡μ‘ν HTML elements μμ΄ν λ€λ κ°λ¨ ν΄μ§λλ€.
selected
μμ±μ μ΄μ©νμ¬ κΈ°λ³Έμ νμΌλ‘ λ μμ΄ν μΌλ‘λ μ μ© ν μ μμ΅λλ€.
css ν λ§ λλ νμν μλ°μ€ν¬λ¦½νΈμ ν€λ μμ μΆκ° νμΈμ.
<link rel="stylesheet" href="../dist/styles/jquery.carousel-3d.default.css" /> <script src="../bower_components/jquery/jquery.js"></script> <script src="../bower_components/javascript-detect-element-resize/jquery.resize.js"></script> <script src="../bower_components/waitForImages/dist/jquery.waitforimages.js"></script> <script src="../bower_components/modernizr/modernizr.js"></script> <script src="../dist/jquery.carousel-3d.js" ></script>
body νκ·Έ μμ
<div id="wrapper"> <div id="myCarousel" data-carousel-3d> <img src="./images/1.jpg" /> <img src="./images/2.jpg" selected /> <img src="./images/3.jpg" /> <img src="./images/4.jpg" /> <img src="./images/5.jpg" /> </div> </div>
- HTMLλ¬Έμμ μμμμκ° νμν λ divμ ν¨κ» 컨ν μΈ λ₯Ό κ°μΈ μ£ΌμΈμ.
<div style="min-width: 640px; min-height: 420px; max-width: 640px; max-height: 420px;"> <p style="background-color:black; color:white; margin:20px; padding:20px;">A simple html child</p> <div style="background-color:gray; color:white;">Html contents also works ok!!!</div> <div>The quick brown fox jumps over the lazy dog</div> <p> Make the fox <button type="button" onclick="alert('Jump!!');">jump</button> </p> </div>
μΌλ¬μ μ 100% width & aspect height λ₯Ό λΆλͺ¨μμλ‘ κ°μ§λλ€. κ·Έλμ divλ₯Ό μ λΉν ν¬κΈ°λ‘ κ°μ νμκ° μμ΅λλ€. κ·Έλ¦¬κ³ 3d μ ν ν¨κ³Όλ wide aspect(3:2, 2:1 ...)μ λλ₯Ό μΆμ²λ립λλ€.
Multiple Carouselsμ ꡬννκ³ μΆλ€λ©΄ κ°λ¨νκ² proper attribuesλ₯Ό μ€μ ν΄ μ£Όλ κ²λ§μΌλ‘ μ¬λ¬λΆμ΄ μνλ λλ‘ μ½κ² ꡬν ν μ μμ΅λλ€.
API μ°Έμ‘°
- prev / next μΌλ¬μ μν
$('#myCarousel').Carousel3d('prev'); $('#myCarousel').Carousel3d('next');
- index μ μν μΌλ¬μ μν
$('#myCarousel').Carousel3d('rotate', 3);
- μ΄λ²€νΈ 리μ€λ
$('#myCarousel').on('select', function (evt, index) { console.log('item selected : ' + index); });
νμ€ν 리
0.2.2
- semi-NSFW image μμ λ¨.
- μμ html μμ μλͺ»λ js μ½λ μμ λ¨.
0.2.1
- λ²κ·Έ μμ : Multiple instances #4
0.2.0
- Re-μμ§λμ΄ νλ‘μ νΈ
0.1.0
- λ³ν(λ³ν) ν₯μλ¨
- ν λ§ νΉμ§ μΆκ°λ¨
λΌμ΄μΌμ€
MIT Β© PAIO