如何从bootstrap的导航栏切换中移除汉堡包我想将其更改为X按钮,以便当我向左侧滑动时单击侧边, 如果我在红色矩形内部点击如何折叠sidenav?谢谢
这是我的代码
// core class
public static class Quiz
{
private static Random rnd = new Random();
public static Question[] Questions = new[]
{
new Question
{
QuestionText = "Sample uestion 1?",
CorrectAnswer = "Answer to question 1",
WrongAnswers = new [] {
"Wrong answer 1",
"Wrong answer 2",
"Wrong answer 3",
"Wrong answer 4",
"Wrong answer 5",
}
},
new Question
{
QuestionText = "Sample uestion 2?",
CorrectAnswer = "Answer to question 2",
WrongAnswers = new [] {
"Wrong answer 1",
"Wrong answer 2",
"Wrong answer 3",
"Wrong answer 4",
"Wrong answer 5",
}
}
};
public class Question
{
public string QuestionText { get; set; }
public string CorrectAnswer { get; set; }
public string[] WrongAnswers { get; set; }
public string[] GetMultipleChoice(int numberOfChoices)
{
var list = new List<string>() { CorrectAnswer };
list.AddRange(WrongAnswers.Take(numberOfChoices - 1));
// shuffle
int n = list.Count;
while (n > 1)
{
n--;
int k = rnd.Next(n + 1);
var value = list[k];
list[k] = list[n];
list[n] = value;
}
return list.ToArray();
}
}
}
// console application
static void Main(string[] args)
{
foreach (var question in Quiz.Questions)
{
// write question
Console.WriteLine(question.QuestionText);
Console.WriteLine(string.Join(Environment.NewLine, question.GetMultipleChoice(4)));
var response = Console.ReadLine();
if (response.Equals(question.CorrectAnswer, StringComparison.InvariantCultureIgnoreCase))
{
Console.WriteLine("Correct!");
}
else
{
Console.WriteLine("Wrong");
}
}
}
答案 0 :(得分:0)
对于X符号,您可以替换:
<button class = "navbar-toggle" id="opt_menu">
<span class="sr-only">Toggle navigation</span>
<span class= "icon-bar"> </span>
<span class= "icon-bar"> </span>
</button>
with:
<button class = "navbar-toggle" id="opt_menu"> × </button>
要在侧边栏外部点击时折叠sidenav,这可能会有所帮助:
How to close an open collapsed navbar when clicking outside of the navbar element in Bootstrap 3?