I'm working on my portfolio site and I've added a slight parallax effect to my header.
You can see this effect here:
http://claytonkinder.github.io/#/profile
It is VERY unfinished at the moment, so I'd advise only looking at it in Chrome.
This effect lags terribly on mobile devices, so I'm trying to remove all parallax effects from them.
I've got it working by using ng-show to show/hide different headers depending on if my isMobile variable is true or false, but that's a lot of duplicated code and I think it's pretty sloppy.
This is my complete header code:
<header ng-show="!isMobile" parallax-background parallax-ratio="0.2" ng-controller="NavController">
<div>
<div parallax parallax-ratio="1.4" parallax-vertical-offset="0" parallax-horizontal-offset="0">
<h1>Clayton</h1>
</div>
<div parallax parallax-ratio="1.15" parallax-vertical-offset="0" parallax-horizontal-offset="0">
<h1>Kinder</h1>
</div>
</div>
<nav set-class-when-at-top="fixToTop" add-class-when-mobile>
<div class="navWrapper">
<div class="navLeft">
<div>
<span>Clayton Kinder</span>
</div>
<div>
<a href="https://github.com/ClaytonKinder"><i class="fa fa-github" title="Github"></i></a>
<a href="tel:843-324-7727"><i class="fa fa-phone" title="Phone"></i></a>
<a href="mailto:ClaytonAlanKinder@gmail.com"><i class="fa fa-envelope-o" title="Email"></i></a>
</div>
</div>
<div class="navRight">
<div>
<a href="#/profile" ng-class="{active: $route.current.activePage == 'profile'}">PROFILE</a>
<a href="#/projects" ng-class="{active: $route.current.activePage == 'projects'}">PROJECTS</a>
<a href="#/contact" ng-class="{active: $route.current.activePage == 'contact'}">CONTACT</a>
</div>
</div>
</div>
</nav>
</header>
The mobile version is exactly the same except for lacking all of the parallax-related attributes, meaning that this:
<header ng-show="!isMobile" parallax-background parallax-ratio="0.2" ng-controller="NavController">
becomes this:
<header ng-show="!isMobile">
My question is: what's the best way to get the finished header I'm looking for? Can I add/remove attributes based on an expression? Can I just do ng-show/ng-if on the beginning header tag and two divs that have parallax effects instead of having to copy over the entire header again?
Thank you for any and all help.