アクティビティ › コミュニティ › コミュニティ › ファイル添付テスト2 コミュニティ ファイル添付テスト2 トピックス by h.shimizu 302 pt 2023年11月28日 18:40 47 PV ファイル添付テスト2 JavaScript-head-6.txt 5 KB テキストファイル — クリックして 見る コピーダウンロードリンク var sbScrollRevealEnqueteWithRevealHiddenImage = sbScrollRevealEnqueteWithRevealHiddenImage || {}; (function(_) { const classes = { target: '.js-scroll-reveal-enquete-with-reveal', questionItem: '.questionArea', revealArea: '.js-reveal', } const setting = { duration: 600, } _.scrollTo = function(end, duration) { const startTime = Date.now() const easeOut = (p) => p * (2 - p) const start = window.pageYOffset const range = end - start let position = 0 var move = function() { const elapsedTime = Date.now() - startTime const progress = elapsedTime / duration position = start + range * easeOut(progress) if (progress currentNo + 1) { next = linkBoxAll[currentNo + 1]; scrollPoint = next.getBoundingClientRect().top + window.pageYOffset; _.scrollTo(scrollPoint, setting.duration); } }); } nextButton.style.display = 'block'; return; } //関連画像がある場合 if (currentNext && currentNext.classList.contains('q1-related-image')) { const imageToShow = document.querySelector('[class*="related-image"]'); imageToShow.style.display = 'block'; imageToShow.scrollIntoView({ behavior: 'smooth' }); } else { linkBoxAll.forEach(function(linkBox) { if (linkBox.querySelector('input:checked')) checkedLength++; }) if (linkBoxAll.length > currentNo + 1) { next = linkBoxAll[currentNo + 1] scrollPoint = next.getBoundingClientRect().top + window.pageYOffset } if (checkedLength === linkBoxAll.length) { revealArea.classList.remove('is-hidden') scrollPoint = revealArea.getBoundingClientRect().top + window.pageYOffset } if (!current.classList.contains("no-scroll")) { _.scrollTo(scrollPoint, setting.duration) } } }) } _.init = function() { Array.from(document.querySelectorAll(classes.target), el => { _.setEnquete(el); }); } })(sbScrollRevealEnqueteWithRevealHiddenImage); // document.addEventListener('DOMContentLoaded', function() { // // Q1のラジオボタンをすべて取得 // var q1RadioButtons = document.querySelectorAll('input[name="q1"]'); // // 各ラジオボタンにイベントリスナーを設定 // q1RadioButtons.forEach(function(radioButton) { // radioButton.addEventListener('change', function() { // if (this.checked) { // // 画像を表示する処理 // var imageToShow = document.querySelector('.q1-related-image'); // if (imageToShow) { // imageToShow.style.display = 'block'; // 画像を表示 // // 画像までスクロールする(オプション) // imageToShow.scrollIntoView({ behavior: 'smooth' }); // } // } // }); // }); // }); クリックして展開 h.shimizu 1 年, 5 月前 1 人 · 0 コメント 0 コメント 申し訳ありませんが、返信は見つかりませんでした。 Log In to Reply すべての人 コミュニティメンバー 自分のみ すべての人コミュニティメンバー自分のみ すべての人 コミュニティメンバー 自分のみ Log In to Reply トピックスの始まり 0 / 0 コメント 2018年6月 今