从ngView(Vegas幻灯片)加载模板时CSS更改

时间:2015-10-27 11:42:51

标签: javascript jquery html css angularjs

我正在实施简单的网页,我希望主页面带有全屏滑块http://vegas.jaysalvat.com/)以及下面的一些内容。另一方面,我想有一个额外的视图,我想禁用全屏,只是有一些其他内容。

我正在使用通过yeoman https://github.com/yeoman/generator-angular生成的Angular项目和一些免费的可用引导程序模板。

当我将所有主页代码放入index.html (我有所有的bower组件,css,自定义脚本)时,Eveything工作得很好 - 全屏显示拉斯维加斯幻灯片,我有它上面的内容。

enter image description here

然而 - 当我将主页内容(拉斯维加斯幻灯片+内容)移动到角度视图(让我们称之为mani)时只留下index.hmtl中的导航栏菜单,页脚等,CSS似乎被打破为拉斯维加斯幻灯片现在不会覆盖整个屏幕,只是它的一部分。 - 您可以看到显示内容(黑色背景div),而应显示全屏+图像移动到顶部/截断。

enter image description here

我认为它与渲染顺序有关(角度tempalte最有可能异步加载),我尝试过移动东西,在文档准备好后运行拉斯维加斯但没有成功。

一段代码:

的index.html

 <body ng-app="semApp" id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<!--[if lte IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
    your browser</a> to improve your experience.</p>
<![endif]-->

<!-- Navigation -->
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
                <i class="fa fa-bars"></i>
            </button>
            <a class="navbar-brand page-scroll" href="#page-top">
                <span class="light">Isabel</span>
            </a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-right navbar-main-collapse">
            <ul class="nav navbar-nav">
                <!-- Hidden li included to remove active class from about link when scrolled up past about section -->
                <li class="hidden">
                    <a href="#page-top"></a>
                </li>
                <li>
                    <a class="page-scroll" href="#/#about">O nas</a>
                </li>
                <li>
                    <a class="page-scroll" href="/#/#download">Download</a>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

<div ng-view=""></div>
</div>

<!-- Footer -->
<footer>
    <div class="container text-center">
        <p>Copyright &copy; Your Website 2014</p>
    </div>
</footer>

main.html中:

<!-- Intro Header -->
<header class="intro">
  <div class="intro-body">
    <div class="container middlePage">
      <div class="row">
        <div class="col-md-8 col-md-offset-2">
          <h1 class="brand-heading">Isabel</h1>
          <p class="intro-text">
            <a href="" class="btn btn-default">Kolekcja 2016</a></p>
          <a href="#about" class="btn btn-circle page-scroll">
            <i class="fa fa-angle-double-down animated"></i>
          </a>
        </div>
      </div>
    </div>
  </div>
</header>

<!-- Download Section -->
<section id="download" class="content-section text-center">
  <div class="download-section">
    <div class="container">
      <div class="col-lg-8 col-lg-offset-2">
        <h2>Download Grayscale</h2>
        <p>You can download Grayscale for free on the preview page at Start Bootstrap.</p>
        <a href="http://startbootstrap.com/template-overviews/grayscale/" class="btn btn-default btn-lg">Visit Download Page</a>
      </div>
    </div>
  </div>
</section>

<script>
$( document ).ready(function() {
        $(".intro-body").vegas({
    slides: [
        { src: "images/1.jpg" },
        { src: "images/2.jpg" }
    ]
});
});
</script>

的CSS:

/*!
 * Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */
@import url(http://fonts.googleapis.com/css?family=Lato); /* FREE GOOGLE FONTS */
@import url(https://fonts.googleapis.com/css?family=Cinzel|Great+Vibes);

body {
    width: 100%;
    height: 100%;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    color: #fff;
    background-color: #000;
}

html {
    width: 100%;
    height: 100%;
}

h1 {
    margin: 0 0 0px;
    font-family: 'Great Vibes', cursive;
    font-weight: 500;
    letter-spacing: 1px;
}

h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 30px;
    font-family: 'Lato', sans-serif;
    font-weight: 500;
    letter-spacing: 1px;
}

p {
    margin: 0 0 25px;
    font-size: 18px;
    line-height: 1.5;
}

@media(min-width:768px) {
    p {
        margin: 0 0 35px;
        font-size: 20px;
        line-height: 1.6;
    }
}

a {
    color: #42dca3;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    transition: all .2s ease-in-out;
}

a:hover,
a:focus {
    text-decoration: none;
    color: #1d9b6c;
}

.light {
    font-weight: 400;
}

.navbar-custom {
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255,255,255,.3);
    text-transform: uppercase;
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    background-color: #000;
}

.navbar-custom .navbar-brand {
    font-weight: 700;
}

.navbar-custom .navbar-brand:focus {
    outline: 0;
}

.navbar-custom .navbar-brand .navbar-toggle {
    padding: 4px 6px;
    font-size: 16px;
    color: #000;
}

.navbar-custom .navbar-brand .navbar-toggle:focus,
.navbar-custom .navbar-brand .navbar-toggle:active {
    outline: 0;
}

.navbar-custom a {
    color: #fff;
}

.navbar-custom .nav li a {
    -webkit-transition: background .3s ease-in-out;
    -moz-transition: background .3s ease-in-out;
    transition: background .3s ease-in-out;
}

.navbar-custom .nav li a:hover {
    outline: 0;
    color: rgba(255,255,255,.8);
    background-color: transparent;
}

.navbar-custom .nav li a:focus,
.navbar-custom .nav li a:active {
    outline: 0;
    background-color: transparent;
}

.navbar-custom .nav li.active {
    outline: 0;
}

.navbar-custom .nav li.active a {
    background-color: rgba(255,255,255,.3);
}

.navbar-custom .nav li.active a:hover {
    color: #fff;
}

@media(min-width:768px) {
    .navbar-custom {
        padding: 20px 0;
        border-bottom: 0;
        letter-spacing: 1px;
        background-color: rgba(0,0,0,0.5);
        -webkit-transition: background .5s ease-in-out,padding .5s ease-in-out;
        -moz-transition: background .5s ease-in-out,padding .5s ease-in-out;
        transition: background .5s ease-in-out,padding .5s ease-in-out;
    }

    .navbar-custom.top-nav-collapse {
        padding: 0;
        border-bottom: 1px solid rgba(255,255,255,.3);
        background: #000;
    }
}

.intro {
    display: table;
    width: 100%;
    height: auto;
    padding: 100px 0;
    text-align: center;
    color: #000;
    background-color: #000;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

.intro .intro-body {
    display: table-cell;
    vertical-align: middle;
}

.intro .intro-body .brand-heading {
    font-size: 40px;
}

.intro .intro-body .intro-text {
    font-size: 18px;
}

.logo-about {
    height: 100px;
}

.middlePage {
    padding-top: 20%;
}

@media(min-width:768px) {
    .intro {
        height: 100%;
        padding: 0;
    }

    .intro .intro-body .brand-heading {
        font-size: 100px;
    }

    .intro .intro-body .intro-text {
        font-size: 26px;
    }
}

.btn-circle {
    width: 70px;
    height: 70px;
    margin-top: 15px;
    padding: 7px 16px;
    border: 2px solid #000;
    border-radius: 100%!important;
    font-size: 40px;
    color: #000;
    background: 0 0;
    -webkit-transition: background .3s ease-in-out;
    -moz-transition: background .3s ease-in-out;
    transition: background .3s ease-in-out;
}

.btn-circle:hover,
.btn-circle:focus {
    outline: 0;
    color: #000;
    background: rgba(255,255,255,.1);
}

.btn-circle i.animated {
    -webkit-transition-property: -webkit-transform;
    -webkit-transition-duration: 1s;
    -moz-transition-property: -moz-transform;
    -moz-transition-duration: 1s;
}

.btn-circle:hover i.animated {
    -webkit-animation-name: pulse;
    -moz-animation-name: pulse;
    -webkit-animation-duration: 1.5s;
    -moz-animation-duration: 1.5s;
    -webkit-animation-iteration-count: infinite;
    -moz-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
    -moz-animation-timing-function: linear;
}

@-webkit-keyframes pulse {    
    0% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }

    50% {
        -webkit-transform: scale(1.2);
        transform: scale(1.2);
    }

    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

@-moz-keyframes pulse {    
    0% {
        -moz-transform: scale(1);
        transform: scale(1);
    }

    50% {
        -moz-transform: scale(1.2);
        transform: scale(1.2);
    }

    100% {
        -moz-transform: scale(1);
        transform: scale(1);
    }
}

.content-section {
    padding-top: 150px;
}

.download-section {
    width: 100%;
    padding: 50px 0;
    color: #fff;
    background: url(../images/downloads-bg.jpg) no-repeat center center scroll;
    background-color: #000;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

#map {
    width: 100%;
    height: 200px;
    margin-top: 100px;
}

@media(min-width:767px) {
    .content-section {
        padding-top: 100px;
    }

    .download-section {
        padding: 100px 0;
    }

    #map {
        height: 400px;
        margin-top: 250px;
    }
}

.btn {
    border-radius: 0;
    text-transform: uppercase;
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-weight: 400;
    -webkit-transition: all .3s ease-in-out;
    -moz-transition: all .3s ease-in-out;
    transition: all .3s ease-in-out;
}

.btn-default {
    border: 1px solid #000;
    color: #000;
    background-color: transparent;
}

.btn-default:hover,
.btn-default:focus {
    border: 1px solid (0,0,0,.2);
    outline: 0;
    color: #000;
    background-color: rgba(0,0,0,.2);
}

ul.banner-social-buttons {
    margin-top: 0;
}

@media(max-width:1199px) {
    ul.banner-social-buttons {
        margin-top: 15px;
    }
}

@media(max-width:767px) {
    ul.banner-social-buttons li {
        display: block;
        margin-bottom: 20px;
        padding: 0;
    }

    ul.banner-social-buttons li:last-child {
        margin-bottom: 0;
    }
}

footer {
    padding: 50px 0;
}

footer p {
    margin: 0;
}

::-moz-selection {
    text-shadow: none;
    background: #fcfcfc;
    background: rgba(255,255,255,.2);
}

::selection {
    text-shadow: none;
    background: #fcfcfc;
    background: rgba(255,255,255,.2);
}

img::selection {
    background: 0 0;
}

img::-moz-selection {
    background: 0 0;
}

body {
    webkit-tap-highlight-color: rgba(255,255,255,.2);
}

任何帮助apprieciated!

更新 - JSFiddle链接http://jsfiddle.net/qtkfq2d7/

0 个答案:

没有答案