私は符号化ブートキャンプのためのトリビアゲームを作っています。私はタイマー、質問、および4つのクリック可能な回答を表示するジャンボトロンをメインの背景画像に持っています。私はそのジャンボトロンで、トリビア銀行の質問(それは対象)に保存されている指定された画像であることを望みます。私は画像を表示することができますが、それは伸び過ぎており、それはタイマー/ quesitons /ボタンを取り除きます。どうやってジャンボトロンのサイズの背景に直接置くことができますか?あなたの代わりにbackground-image
としてそれを使用できる場合ジャンボトロンに大きな画像をどのようにフィットさせることができますか?
function displayNextQuestion() {
initialTimer = 21;
console.log(questionBank[triviaQuestions[counter]].question);
console.log(questionBank[triviaQuestions[counter]].correctAnswer);
var questionToDisplay = $('<h2>').addClass('question').text(questionBank[triviaQuestions[counter]].question);
var answerButtons = $('<div>').addClass('answers');
var numberOfAnswers = questionBank[triviaQuestions[counter]].answers.length;
for (var i = 0; i < numberOfAnswers; i++) {
var newButton = $('<button>').addClass('answer btn btn-lrg btn-default btn-block').text(questionBank[triviaQuestions[counter]].answers[i])
.data('index', i).on("click", checkAnswer);
answerButtons.append(newButton);
}
$(".jumbotron").empty().append('<img src =' + questionBank[triviaQuestions[counter]].imageUrl + '>');
$('#question').empty().append(questionToDisplay, answerButtons);
// console.log(questionBank[triviaQuestions[counter]].imageUrl);
run();
}
StackOverflowへようこそ。あなたの質問には、最小限で完全で検証可能な例が含まれていなければなりません。[here's how](http://stackoverflow.com/help/mcve) – hungerstar