feat(video): add video fit toggle button and update styling
- Add toggle button to switch between 'cover' and 'contain' video fit modes - Update video background styling for simpler positioning - Group upload and fit buttons in a flex container
This commit is contained in:
@@ -7,6 +7,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const micButton = document.getElementById('mic-button');
|
||||
const favorabilityBar = document.getElementById('favorability-bar');
|
||||
|
||||
const toggleFitButton = document.getElementById('toggle-fit-button');
|
||||
|
||||
// --- 视频上传功能 ---
|
||||
videoUploadInput.addEventListener('change', function(event) {
|
||||
const file = event.target.files[0];
|
||||
@@ -27,6 +29,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
});
|
||||
|
||||
// --- 视频适应模式切换功能 ---
|
||||
let isFitHeight = false;
|
||||
toggleFitButton.addEventListener('click', function() {
|
||||
isFitHeight = !isFitHeight;
|
||||
if (isFitHeight) {
|
||||
bgVideo.style.objectFit = 'contain';
|
||||
toggleFitButton.textContent = '适应宽度';
|
||||
} else {
|
||||
bgVideo.style.objectFit = 'cover';
|
||||
toggleFitButton.textContent = '适应高度';
|
||||
}
|
||||
});
|
||||
|
||||
// --- 麦克风按钮交互和好感度条模拟 ---
|
||||
let isListening = false;
|
||||
let currentFavorability = 65; // 与 CSS 中的初始宽度保持一致
|
||||
|
||||
Reference in New Issue
Block a user