- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道有很多关于此的问题,但似乎没有一个答案对我有用。我正在尝试编写一些 jquery 来让我的 Bootstrap 导航栏在有人滚动传递元素后改变颜色。有人可以告诉我我做错了什么。谢谢!
Github 链接:https://github.com/Sruthik22/Sruthik22.github.io jquery 在头部
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="utf-8">
<title>Sruthi Kurada</title>
<meta name="description" content="Sruthi Kurada's Personal Website">
<meta name="author" content="Sruthi Kurada">
<!-- CSS Stylesheets -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
<script type="text/javascript">
$(document).ready(function(){
var scroll_start = 0;
var startchange = $('#Home');
var offset = startchange.offset();
if (startchange.length){
$(document).scroll(function() {
scroll_start = $(this).scrollTop();
if(scroll_start > offset.top) {
$('nav.navbar-custom').css('background-color', '#f0f0f0');
} else {
$('nav.navbar-custom').css('background-color', 'transparent');
}
});
}
});
</script>
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-custom">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#Home">Sruthi Kurada</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="nav navbar-nav navbar-right">
<a class="navbar-brand nav-elements page-scroll" href="#Home">Home</a>
<a class="navbar-brand nav-elements page-scroll" href="#About">About</a>
<a class="navbar-brand nav-elements page-scroll" href="#Skills">Skills</a>
<a class="navbar-brand nav-elements page-scroll" href="#Portfolio">Portfolio</a>
<a class="navbar-brand nav-elements page-scroll" href="#Contact">Contact</a>
</div>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<a name = "Home" id = "Home"></a>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="Images/Robotics.jpg" alt="FLL Robotics Robot">
<div class="carousel-caption">
<h1>Innovator</h1>
</div>
</div>
<div class="item">
<img src="Images/Math.jpg" alt="Math on a chalkboard">
<div class="carousel-caption">
<h1>Math Enthusiast</h1>
</div>
</div>
<div class="item">
<img src="Images/PythonCode.png" alt="Python Code on Computer">
<div class="carousel-caption">
<h1>Coder</h1>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!--About Me-->
<a name="About" id = "About"></a>
<div class = "About">
<div class="container">
<br>
<div id="sruthi-picture"></div>
<div class="row">
<div class = "col-md-1 col-xs-1"></div>
<div class="col-md-10 col-xs-10 text-center" id="Intro">
My name is Sruthi Kurada
</div>
<div class = "col-xs-1"></div>
</div>
<div class="row">
<div class = "col-xs-1"></div>
<div class="col-xs-10 text-center" id = "Subtitle">
I am a 7th Grader at the Advanced Math & Science Academy (AMSA).
</div>
</div>
<br>
<div class="row">
<div class = "col-xs-1"></div>
<div class="col-xs-10 text-center" id = "about-descript">
I am interested in Robotics, Math, and Coding. I participate in FLL a Lego Robotics Competition. I do many mathamatics competitions, and I have coded several Python and Java Projects.
</div>
</div>
<div class="row">
<div class = "col-xs-1"></div>
<div class="col-xs-10 text-center" id = "about-descript">
I enjoy designing technology for less fortunate people and recently designed a belt to help the blind. I also play basketball & do karate as extracuriculars.
</div>
</div>
<br>
</div>
</div>
<div class = "AMSA">
<div class="row">
<div class = "col-xs-1"></div>
<div class="col-xs-10 text-center vcenter" id = "amsaText">
<p>My school the Advanced Math and Science Academy is where I participate in many activities with my friends.</p>
</div>
</div>
</div>
<a name="Skills"></a>
<div class="container">
<div class="row text-center">
<div class="col-lg-10 col-lg-offset-1">
<h2 id = "SkillsTitle">Skills</h2>
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="service-item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-users fa-stack-1x text-primary portfolioIcon" aria-hidden="true"></i>
</span>
<h4>
<strong class = "PortfolioTextTitle">Leadership</strong>
</h4>
<br>
<p class = "PortfolioText"> Taught people on my FLL team how to build robots. Also have taught kids how to code</p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="service-item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-android fa-stack-1x text-primary portfolioIcon" aria-hidden="true"></i>
</span>
<h4>
<strong class = "PortfolioTextTitle">App Developement</strong>
</h4>
<br>
<p class = "PortfolioText"> Learning Android Development and currently working on Udacity Nanodegree </p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="service-item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-code fa-stack-1x text-primary portfolioIcon" aria-hidden="true"></i>
</span>
<h4>
<strong class = "PortfolioTextTitle">Python</strong>
</h4>
<br>
<p class = "PortfolioText"> Well versed in Python Application Development as well as Django Framework. </p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="service-item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-code fa-stack-1x text-primary portfolioIcon" aria-hidden="true"></i>
</span>
<h4>
<strong class = "PortfolioTextTitle">Java</strong>
</h4>
<br>
<p class = "PortfolioText"> Proficent in Java Developement. Currently learning Machine Learning.</p>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
<a name="Portfolio"></a>
<div class = "Portfolio">
<div class="row">
<div class = "col-md-1 col-xs-1"></div>
<div class="col-md-10 col-xs-10 text-center" id="PortfolioTitle">
Portfolio
</div>
<div class = "col-xs-1"></div>
</div>
<div class = "row">
<div class = "col-md-2 col-sm-0"></div>
<div class="col-md-4 col-sm-6">
<div class = "portfolio-box">
<a title = "Movie App Github Source Code" href = "https://github.com/Sruthik22/MoviesApp">
<img class = "img-portfolio img-responsive" src = "Images/PopularMovies.PNG"/>
<p class = "imagetext">Movies App</p>
<div class = "portfolio-box-caption">
<div class = "portfolio-box-caption-content">
<div class = "project-category text-faded">
Android Development
</div>
<div class = "project-name">
An Android app I created that lets users find most popular movies and the top rated movies. Once you click on a movie specific movie poster then it will give you more specific details such as movie title and release date.
</div>
</div>
</div>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class = "portfolio-box">
<a title = "Clash of the Math Titans Github Source Code" href = "https://github.com/Sruthik22/Clash-of-the-Math-Titans">
<img class = "img-portfolio img-responsive" src = "Images/ClashOfTheMathTitans.png" alt="Code of Clash of the Math Titans"/>
<p class = "imagetext">Clash of the Math Titans</p>
<div class = "portfolio-box-caption">
<div class = "portfolio-box-caption-content">
<div class = "project-category text-faded">
Code
</div>
<div class = "project-name">
At a Hackathon my teammate and I designed this python game that helps young children learn the Order of Operations by gamifying it.
</div>
</div>
</div>
</a>
</div>
</div>
<div class = "col-md-2 col-sm-0"></div>
</div>
<br>
<div class = "row">
<div class = "col-md-2 col-sm-0"></div>
<div class="col-md-4 col-sm-6">
<div class = "portfolio-box">
<a title = "Battleship Github Source Code" href = "#">
<img class = "img-portfolio img-responsive" src = "Images/Battleship.png" alt="The Battleship code"/>
<p class = "imagetext">Battleship</p>
<div class = "portfolio-box-caption">
<div class = "portfolio-box-caption-content">
<div class = "project-category text-faded">
Code
</div>
<div class = "project-name">
The game battleship coded in python. There is both a single player mode and a multiplayer mode. The game also has graphics with the help of the graphics module graphics.py
</div>
</div>
</div>
</a>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class = "portfolio-box">
<a title = "Movie App Github Source Code" href = "https://www.youtube.com/watch?v=ogvRFzNWM2w">
<img class = "img-portfolio img-responsive" src = "Images/BeltForTheBlind.PNG" alt="Picture of the Limits of what a Product like the Blind Belt could do"/>
<p class = "imagetext">Belt for the Blind</p>
<div class = "portfolio-box-caption">
<div class = "portfolio-box-caption-content">
<div class = "project-category text-faded">
Hardware
</div>
<div class = "project-name">
A product I designed along with another team mate that helps the blind traverse their surroundings. It guides the user by using a ultrasonic sensor and alerts the user by using a volume component on the side of the bot. We won 3rd place in ProjectCSGirls.
</div>
</div>
</div>
</a>
</div>
</div>
<div class = "col-md-2 col-sm-0"></div>
</div>
<br>
</div>
<a name="Contact"></a>
<div class = "Contact">
<div class="row">
<div class = "col-md-1 col-xs-1"></div>
<div class="col-md-10 col-xs-10 text-center">
<h1 id="ContactTitle">Contact</h1>
</div>
<div class = "col-xs-1"></div>
</div>
<div class = "row">
<div class = "col-md-4 col-sm-4"></div>
<div class = "col-md-1 col-sm-1">
<a target="_blank" href = "https://github.com/Sruthik22" class = "social"><i class="fa fa-github-square social"></i></a>
</div>
<div class="col-md-2 center col-sm-2">
<a target="_blank" href = "mailto:fllheroes638@gmail.com" class = "social"><i class="fa fa-envelope icon social"></i></a>
</div>
<div class = "col-md-1 col-sm-1">
<a target="_blank" href = "http://stackoverflow.com/users/5693112/sruthi-kurada" class = "social"><i class="fa fa-stack-overflow social"></i></a>
</div>
<div class = "col-md-4 col-sm-4"></div>
</div>
</div>
</body>
</html>
最佳答案
您只是将 background-color
应用于错误的元素。试试这个:
$(document).scroll(function() {
scroll_start = $(this).scrollTop();
if(scroll_start > offset.top) {
$('nav.navbar-custom').css('background-color', '#f0f0f0');
} else {
$('nav.navbar-custom').css('background-color', 'transparent');
}
});
关于jquery - 更改滚动条上 Bootstrap 导航栏的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38647415/
ion-nav-view 嵌套有一个奇怪的问题。当我在浏览器中加载应用程序时,我可以看到 URL 正在更改为 /app/menu,但页面上没有出现 menu.html 中的内容。页面是空白的。 以下是
运行截图如下: 源码如下: CN_TEST1
我正在开发一个示例reactjs应用程序(在学习过程中)。我有一个页面,其中列出了用户列表和一个用于添加新用户的添加按钮。 当我单击添加按钮时,我应该导航到用户表单以创建新用户。 单击用户表单中的提交
我的导航栏中的导航链接有问题。首先,它没有在导航栏中间对齐,如下所示: 另一部分是,我正在使用填充来执行此操作,因此如果我放置除“测试”以外的任何内容或将其放在不同的情况下,等等。它会重复该框。代码预
基本上,我有一个网站,我正在尝试使用 ajax 导航构建它,以便它获取网页并将它们加载到同一页面中。问题是当我正常放入内容时它工作正常但是当我尝试将内容添加到外部文档并从导航中访问它时框拆分你可以在这
以下站点左侧菜单的导航使用 CSS 进行鼠标悬停链接。 PVH 当我获取导航代码并将其设为单独的页面时。然后鼠标悬停链接不起作用。可能是什么原因? Test 最佳答案 可能... 对此事有话要说
一 问题描述 标准的 Web 浏览器包含在最近访问过的页面中向后和向前移动的功能。实现这些特性的一种方法是使用双栈来跟踪前后移动可以到达的页面。 Web 导航支持下面的命令。 后退页面:将当前页面推到
我想有条件地导航到某个页面。如果某些条件为真,我想导航到其他页面,否则我想留在同一页面上。我有类似的东西:- 在 bean.navigate 我有类似的东西:- public String navi
问题:有没有办法让按钮在用户控件中表现得像超链接? 我已经搜索了几天,但没有找到解决此问题的人。如何使用按钮在 WPF 应用程序中导航?具体来说,如何使用户控件内的按钮在其主机框架中导航?请记住,用户
我尝试使用 Android Navigation 组件并遇到了回栈问题。 我有 fragment A,B。 我写的: Navigation.findNavController(view).naviga
我有一个父布局,并从该子站点派生而来。 父级布局具有一个导航,每个导航点代表一个子站点。 如何在父布局中突出显示当前查看的子站点? 如果看起来如何? 最佳答案 可能不是最好的选择,但这是基于路由名称的
我正在开发Blazor服务器端应用程序。熟悉Blazor的任何人都在左侧的NavBar中填充超链接,并以特殊的CSS类进行装饰。我的问题是,如果任何内容都已编辑,我将试图停止导航并在一个特定页面上显示
我是 flutter 的新手,我正在开发一个具有多个屏幕的应用程序。 我想知道如何阻止 flutter 创建同一路线的多个屏幕, 例如我有 第1页和 第2页 ,如果我单击按钮导航到第 2 页并再次单击
我们的设计师创建了一个类似于上面屏幕的布局。主要思想是创建一个只有一个屏幕的应用程序,当您点击一个按钮时,屏幕的红色部分会发生变化(即 2 个文本框而不是 1 个文本框)。这个应用程序将是一个多平台应
有人可以解释为什么从pageE返回时不打印efeioi吗? 页面A Navigator.pushNamed(context, PageB.ROUTE).then((onValue) {
我需要在 iOS 应用程序中创建一个导航,如下图所示。 它包含一个标签栏和一个侧边菜单。 问题是正确的导航菜单按钮,应该在所有选项卡中都可见。甚至每个选项卡的所有内部屏幕。 当用户从侧面菜单中选择一个
这个问题在这里已经有了答案: Vim: move around quickly inside of long line (8 个答案) 关闭 8 年前。 我正在用 vim 编辑一个文本文件,我已经使
我很困惑,如何执行操作来创建从用户位置到用户选择/点击图钉覆盖层的图钉覆盖层(谷歌位置)的路线/导航。这是我的 map Activity ,它将显示我的 map 。 public class Plac
我正在使用 jQuery 函数 .animate 来一一突出显示导航链接。他们在 ul 中。我可以让它工作,只是想知道是否有一种方法可以缩短我的代码,这样我就不必单独突出显示每个项目。提前致谢 $(d
我正在创建一个带有“ anchor 导航”的网站,就像 Facebook 和谷歌邮件一样。我已经让它工作了,但还不完全。当我加载带有 #contact 之类的页面时,除非我单击它的链接,否则它不会加载
我是一名优秀的程序员,十分优秀!