I'm trying to get a page to animate in on load using Angular 1.2 and Animate.css.
Here's the Plunker: http://plnkr.co/edit/oDiDfRCO2Msc0StNrtqH
I'd like the background to crossfade in and the yellow menu on the right side to slide in from the right.
In main.html:
<div>
<div class="background-container">
<my-Background></my-Background>
</div>
<div class="menu-container">
<my-Menu id="menu"></my-Menu>
</div>
</div>
In main.css:
.menu-container.ng-enter {
animation:3s fadeInRightBig;
}
.background-container.ng-enter {
animation:3s fadeInDown;
}
The animations defined in main.css don't seem to get fired. I'm pretty sure its due to the order and/or timing of css being loaded although I might be dealing with more than one issue.
What's the "right" way to ensure everything, from an animation standpoint, is loaded and ready in order to make the animations work on load?
Have you looked at something like an HTML5 loader to load your initial assets when the DOM is loaded. There is a jQuery plugin, I know it is not Angular and another library, but it may help your order of operation.
http://gianlucaguarini.github.io/jquery.html5loader/
You can try nganimate , an easy documentation for you to refer
https://docs.angularjs.org/api/ngAnimate
Related
I am in the process of creating a Shopify store and would like to go a little beyond what the themes are offering. Specifically I am triyng to add wow.js and animate.css.
As you can see below, I have added the CDN for Animate.css in the head tag of template.liquid.
Next I added the CND for Wow.js and activated is as such:
It seems to be loading the scripts just fine, even adds the animated class as one scrolls to the element, but for some reason none of the aniamtion is taking place.
Any input into alleviating this issue is much appreciated!
Well this was utterly annoying. Anyhow the way to refernce/activate Animation.css animations now seems to be with class animate__animated and NOT just animated like it used to be.
This means that when one is initialising wow.js one must change that animationClass to animate__animated as such:
new WOW({
animateClass: 'animate__animated', // --> WOW default is animated but that does not work anymore
}).init();
And the Animation.css animations must be as such:
<div class="wow animate__fadeInUp">Lorem</div>
It might be that your theme's CSS is overriding animate.min.css since it's being loaded before it. Try loading animate.min.css last, just before the closing </head> tag
I currently have a website which uses Animate.css on the frontpage (https://daneden.github.io/animate.css/). How it currently works is that the animation kicks in as soon as the user opens the website, but this causes the animation to "lag". What I would like is to let it wait until the full page loads in before the css animations start to do their thing, thus making the experience much more fluid.
I've looked into several js based preloaders, tried some but it doesn't delay the css animations. As soon as the page is finished loading, the css animations have already been completed. Am I doing something wrong, or are JS preloaders not the right approach?
You would have to use javascript and/or jquery to dynamically add the css class that has the animation to the desired element after the page has been loaded. We can do this with the $document.ready event in jquery.
$(document).ready(function(){
$('css selector').addClass('class-that-has-animation-binding').
});
That is how he is doing it on the main site if you view is source code.
The above approach didn't work for me.
Since a good preloader will wait until ALL page elements, including images, have been displayed, I would wait until then....
$(window).load(function() {
$('css selector').addClass('class-that-has-animation-binding').
});
i use the plugin jQuery custom content scroller.
I'm looking to synchronize two scrollbar (two-way).
Using the callback onWhileScrolling and scrollTo it works but the scrollTo fires at the end of the event . I would like the synchronization is real time (instantaneous).
I also use the mousewheel event on their parent container , it synchronizes the way I want. Only focus on one , I 'm out of sync.
An idea?
Structure:
<div class="parent_container">
<div class="scroll1"><!--div content --></div>
<div class="scroll2"><!--div content --></div>
</div>
thanks
I have done an quick example in JS Bin with jQuery for you.
JS Bin
I'm using the scroll event of jQuery.(it's the best for your needs i think)
I also changed your classes and used id's instead (classes are for multiple use in my opinion).
With my Code you are able to have an dynamic number of synchronized scrolls.
Just add a new div with the id 'scroll3' and class 'syncScroll' to see how it works.
It's also working in "real time" as you wished.
I hope that is helping you.
used jQuery Version: 2.1.1
So I'm currently developing a small website for someone over at http://carrotcrunchpvp.comule.com/.
On the 'our ethos' page, I have a svg running for the radial percentage stats. If you load this page, http://carrotcrunchpvp.comule.com/#horizontal/1 you will notice that there is animation on this SVG which loads it round to the defined % which is in the HTML. This is all done by my javascript file - percentagecircles.js.
Now, my question is, as the animation is triggered by running the file percentagecircles.js, is there any way to run this file ONLY when on the 'Our Ethos' page. For example if you load the homepage, the animation will run when you can't see it.
I am using FullPage.js plugin in the backend. I have noticed while developing that when traversing each page, the class="slide fp-slide fp-table" becomes class="slide fp-slide fp-table active" when on that page.
Logically I would imagine I would use an if function which says, if '#fullpage > div > div.fp-slides > div > div.slide.fp-slide.fp-table has class ;active' (our ethos css path), run the percentagecircles.js file. Seems simple to me retrospectively but my Jquery + Javascript knowledge is very very minimal...
Just a note, I've tried using a couple of plugins like Wow.js and onScreen.js to no success, perhaps I wasn't utilising them right.
Any help is appreciated,
Cheers,
Chris
You need to make make use of the callbacks provided by fullPage.js such as afterSlideLoad or afterLoad.
You will find them explained in the documentation.
And you have available examples such as callbacks.html here.
This way you can get the active slide and work with it.
I tried animate.css library which is working fine in my localhost and jsfiddle but in live site it is not taking action immediately, meaning animate option for the particular div is not happening at the start itself instead the div appears in the specified position at first then it comes from top or whatever effect i am giving.
I think this might be server loading time problem. Might be due to slow loading i can able to see the actual position first then the css class animation is taking place. Am not sure how to over come this.
Jsfiddle with code as in the live site but in js it is working fine.
I tried by giving the class directly in the markup itself instead through js because i thought js may load lately, even though i can able to see the static position on loading the site then the animation taking place from top to bottom
<div id="box" class="animated fadeInDownBig">Checking</div>
I tried by the js way too but no effect. Any idea on what happening here?
This is because your div html code is rendered in browser immediately and as you are calling
$(document).ready(function(){
$('#box').addClass('animated fadeInDownBig');
});
after document load. So, it is simple working according to your code after the document load it adds your animated fadeInDownBig effect. if the library you are using is just simple CSS file then I would recommend you this instead calling after document load
<div id="box" class="animated fadeInDownBig">Checking</div>
And if you got other js files etc in your library then use this code
#box {
width:60%;
height:60%;
left:20%;
top:20%;
background-color:red;
position:fixed;
display:none;
}
<div id="box" class="animated">Checking</div>
$(document).ready(function(){
$('#box').css('display','block').addClass('fadeInDownBig');
});
And far as you are saying it's working fine on your localhost this might be due to it loads every library and files immediately on localhost so $(document).ready is called immediately.