ããã«ã¡ã¯ãèã®ç©´ã©ãã®ã¯ã£ã¨ãã§ãã
ãã©ã¦ã¶ç¨æ¼«ç»ãã¥ã¼ã¢ã¼ã©ã¤ãã©ãª ã ToraViewer ã ãå ¬éããã®ã§ç´¹ä»ãããã¨æãã¾ãã
ã¯ããã«
ãã®è¨äºã§ã¯ãToraViewerã®å©ç¨æ¹æ³ã¨ToraViewerãå©ç¨ãã¦ããæè¡ã«ã¤ãã¦ãç´¹ä»ãã¦ããã¾ãã
ToraViewerã§ä½ãã§ããã®ã
ToraViewerã¯æ¼«ç»ãåçéãªã©ã®ç»åä¸è¦§ãé»åæ¸ç±ã®ãããªå½¢å¼ã§é²è¦§ã§ããã©ã¤ãã©ãªã§ãã
ãã¢ãã¼ã¸ããå®éã®åä½ã確èªãããã¨ãã§ãã¾ãã
ç»é¢ãµã¤ãºã«ããèªåçã«1ãã¼ã¸è¡¨ç¤ºã¨è¦éã表示ãåãæ¿ããã¾ãã ã¾ããå©ç¨ã¦ã¼ã¶ã¼ãæ¯è»ãã¿ã³ããä»»æã®ã¹ã¿ã¤ã«ã«å¤æ´ã§ãã¾ãã
ToraViewerã®ä½¿ãæ¹
ã¾ãã¯ã¤ã³ã¹ãã¼ã«ãã¾ãã
npm i @toralab/tora-viewer
ã¾ãã¯CDNã使ãã¾ãã
<script src="https://cdn.jsdelivr.net/npm/@toralab/tora-viewer"></script>
åºæ¬çãªä½¿ãæ¹ã¯ä»¥ä¸ã®éãã§ãã第1å¼æ°ã«ç»åURLã®é åã渡ãã¾ãã
import toraViewer from '@toralab/tora-viewer'; toraViewer([ 'https://example.com/1.png', 'https://example.com/2.png', 'https://example.com/3.png', 'https://example.com/4.png', ]);
CDNå©ç¨ã®å ´åã¯ãã®ããã«ãã¾ã
<script src="https://cdn.jsdelivr.net/npm/@toralab/tora-viewer"></script> <script> toraViewer([ 'https://example.com/1.png', 'https://example.com/2.png', 'https://example.com/3.png', 'https://example.com/4.png', ]); </script>
ãã®ä»ã®è©³ç´°ãªãªãã·ã§ã³ãã¡ã½ããã«ã¤ãã¦ã¯READMEã«è¨è¼ãã¦ãã¾ãã
ToraViewerã®å©ç¨æè¡
è¨èªã¯TypeScriptãã¢ã¸ã¥ã¼ã«ãã³ãã©ã¯Viteãå©ç¨ãã¦ãã¾ãã
ãã³ãã¬ã¼ãã¨ãã¦JSXãå©ç¨ãã¦ãã¾ãã
JSXãå©ç¨ãã¦ãã¾ãããReactãpreactã¯å©ç¨ãã¦ãã¾ããã çç±ã¨ãã¦ã¯
- ç»å表示å¾ã¯ã¹ã¯ãã¼ã«ããã ããªã®ã§ãç¶æ ãå¤ãããã¨ãå°ãªãã®ã§Reactçã使ãã®ã¯éå°(ã¨æãã)
- ã©ã¤ãã©ãªã¨ãã¦å ¬éãããããä¾åãããã®ãå°ãªããããã£ãã
- ãã³ãã«æã®ãµã¤ãºãå°ãããããã£ãã
ãªã©ã§ã
ãã¼ã¸é·ç§»ã«ã¤ãã¦ã¯Element.scrollIntoViewã¨CSSã®Scroll Snapã¨ãã£ããã©ã¦ã¶æ¨æºæè¡ãå©ç¨ãã¦ãã¾ãã
element?.scrollIntoView();
scroll-snap-type: x mandatory;
ç¾å¨ã®ãã¼ã¸ãã©ãã«ãããã«é¢ãã¦ã¯ いろいろなObserver APIの紹介 - 虎の穴開発室ブログ ã§ç´¹ä»ããIntersectionObserverãå©ç¨ãã¦ãã¾ãã
const observer = new IntersectionObserver( (entries) => { for (const entry of entries) { // ... ç¥ } }, { root: viewerPagesElm, threshold: 0.6, } );
ä»å¾ã®å±æ
ToraViewerã¯æ©è½ã¨ãã¦ã¯æä½éã§ããããä»å¾ã¯ä»¥ä¸ã®ãããªæ©è½è¿½å ãèãã¦ãã¾ãã
- å種æè¨ã®ã«ã¹ã¿ãã¤ãº(å¤è¨èªåãªã©)
- 縦èªã¿å¯¾å¿
- HTMLã¿ã°ããç»åä¸è¦§åå¾
- 使ããè¨å®ã®ã«ã¹ã¿ãã¤ãº
- ãã¼ãã®å¤æ´
æå¾ã«
ãã²ä½¿ã£ã¦ã¿ã¦ãã ããï¼
ãå©ç¨é ãã¦æ°ã«ãªãç¹ãã¾ãã¯ããããæ¹ããããããããæ©è½ãã»ãããªã©ããã¾ãããissueãç«ã¦ã¦ããã ããããã³ã¡ã³ããããã ããã°ã¨æãã¾ãã
P.S.
æ¡ç¨
èã®ç©´ã§ã¯ä¸ç·ã«åã仲éã絶è³åéä¸ã§ãï¼
ãã®è¨äºãèªãã§ãèå³ãæã£ã¦ããã ããæ¹ã¯ãã²å¼ç¤¾ã®æ¡ç¨æ
å ±ãã覧ä¸ããã
yumenosora.co.jp
LINE ã¹ã¿ã³ã
ã¨ã³ã¸ãã¢å°ç¨ã®ã¡ã¤ãã¡ããã¹ã¿ã³ããå®æãã¾ããï¼
ããã®å ´é¢ãã§æãã使ããããªããããªã¹ã¿ã³ããããæ¥å¸¸ã§å½¹ç«ã¤ã¹ã¿ã³ããåè¨ 40 åç¨æãã¾ããã
ã¨ã³ã¸ãã¢ã®çãããã¨ã³ã¸ãã¢ã§ãªãæ¹ããã²ã¹ã¿ã³ãã確èªãã¦ã¿ã¦ãã ããã
store.line.me