app.js DBサーバー接続マニュアル
手順1.【変更】正しいDBサーバーを指定する
変更前
const db = mysql.createConnection({
host: 'localhost',
変更後
const db = mysql.createConnection({
host: 'jitsimeet.funnygeekjp.com',
テスト
以上の修正を行ったあと、/api3004/getでデータ取得できることを確認してください。
card2.html on/off 切り替えマニュアル
手順1.【移動】操作対象 .white と .black の定義を移動
操作対象[.white と .black]の定義を移動するため、一旦削除します。
159行目と160行目を下記に変更します。
変更前
const content = document.querySelector('.white, [data-target="cards"]');
const content2 = document.querySelector('.black, [data-target="cards"]');
変更後
// const content = document.querySelector('.white, [data-target="cards"]');
// const content2 = document.querySelector('.black, [data-target="cards"]');
手順2.【削除】不要なカード属性の設定を削除
164行目, 165行目, 172行目, 173行目 は削除します。
変更前
content.setAttribute('data-target', 'cards');
content2.setAttribute('data-target', 'cards');
content2.setAttribute('data-target', 'cards');
content.setAttribute('data-target', 'cards');
変更後
//content.setAttribute('data-target', 'cards');
//content2.setAttribute('data-target', 'cards');
//content2.setAttribute('data-target', 'cards');
//content.setAttribute('data-target', 'cards');
手順3.【追加】初期設定を追加
155行目と157行目の間に初期値を追加します。
変更前
const label = document.querySelector('label[for="onoff"]'); ★155行目
★ここに初期設定を追加します
sw.addEventListener('change', () => { ★157行目
変更後
const label = document.querySelector('label[for="onoff"]'); ★変更しない。ここから
const content = document.querySelector('.white');
const content2 = document.querySelector('.black');
content.classList.add('on');
content2.classList.add('delete');
sw.addEventListener('change', () => { ★変更しない。ここまでの間に追加
テスト
以上の修正を行ったあと、ブラウザでスイッチの ON / OFF で .white ブロックと .black ブロックが交互に表示されることを確認してください。