Delay in sidebar animation - javascript

I do not know if I can link to the theme that has the problem that I
want to solve. If it is not allowed, please tell me to delete the
question
I'm using this theme:
here
And as you can see, whenever the cursor is on the sidebar, it expands. How can I make the sidebar only get bigger when the cursor is on the sidebar for at least 2 seconds? That a delay occurs before the animation.
Is there any part in the javascripts used by the theme where I can define this delay?

A bit of CSS will do it.
To delay only the opening:
.sidebar-visible .icon-thumbnail,
.sidebar-visible .page-sidebar,
body.sidebar-visible .page-sidebar .sidebar-header .sidebar-header-controls {
transition-delay: 2s;
}
To delay both opening and closing:
.icon-thumbnail,
.page-sidebar,
.page-sidebar .sidebar-header .sidebar-header-controls,
body.sidebar-visible .page-sidebar .sidebar-header .sidebar-header-controls {
transition-delay: 2s;
}
Note this CSS has to be loaded after theme's to work properly.

You can do so using setTimeout.
When the user hovers the sidebar, start a timeout, at the end of the timeout, check if they are still hovering the sidebar. If so, call the function to pop out the menu.

Try use jquery
.mouseout();
for example:
$("p").mouseout(function(){
$("p").delay(5000).hide(1000);
});

Related

Flexslider issue - large blue flash appearing seconds after page load

I've been having some issues with a flexslider on a Wordpress-built site. Basically, when the page loads and the sldier loads a large blue flash appears for a split second then disappears. You can see it in the link below:
http://www.jacksonvilletreebarbers.com/
I'm guessing the jquery isn't called correctly, or at the right time. But I could be wrong.
And help or input would be a great help! Thank you!
If you initiate FlexSlider with the fade animation after page load when images are visible, FlexSlider will set the opacity on the first image to 0 and then fade it in. This will cause a "flashing" which is quite ugly.
One possible solution which doesn't involve any javascript hacking.
Add a .loading class on your flexslider container, e.g. <div class="flexslider loading">.
Configure your flex init script by adding:
start: function(slider) { slider.removeClass('loading'); }
Add this to your CSS:
.flexslider.loading .slides > li:first-child { opacity: 1 !important; }
More about this problem: https://github.com/woothemes/FlexSlider/issues/848

Angular JS and Animate.css: fade animation is janky

I have a dialog in which I'd like to display one of two things depending on the state of a variable. So, I hooked up 2 versions of a form with ng-if.
When you click "delete" button on first state, it toggles to the second state.
I wanted to make it less abrupt, so I tried adding some css:
[ng-if].ng-enter {
animation: fadeIn .5s;
}
[ng-if].ng-leave {
animation: fadeOut .5s;
}
These animations come from the bower package "animate css":
#keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
.fadeIn {
animation-name: fadeIn;
}
However, as you can see in my animated GIF below, what happens is that for a second BOTH forms appear, making the dialog taller, then one fades out.
Is there no way to do a simple fadein/fadeout as in jQuery? I used to do this all the time with it, but trying to get nice UI animation in Angular is eluding me.
I had a similar problem with an Angular app and animations. I ended up having to use jquery - I wish I had a better answer - but it turned out beautifully. One note, though, I had to wrap any jquery I used in a noConflict() and use body on click plus the element because it doesn't exist yet in the DOM:
$.noConflict();jQuery( document ).ready(function( $ ) {
$('body').on('click', "#toggler", function(){
$('#div_to_show').slideDown();
});
});
I realize this a tangential answer and not an elegant solution but it worked for me to get it out the door under a tight deadline.
A clean solution is to change the state you use to check which form is to display when the animation ng-leave ends.
You can use a second variable to set the ng-leave class in the form that will be hidden.
I can't post you some code because i don't know your js and html.

Toggle Div combined with CSS-Hover

I tried a lot to solve the following: A click on "#pageTitle" should open the "#expandMenu". The expandMenu is exactly located in the bottom of the menubar. As you can see in CSS, there is a hover effect on the background-color. The code works fine so far, but even thought I still have a problem: The menubar should stay in the hover-color, till the toogleMenu gets closed. The user need to reach the expandMenu with his mouse for interacting. But after that, with my current code the via jQuery added css doesn't reset itself to the default css-hover mode.
It also would be nice, if the solution could include the possibility to add some further events, for example a switching icon (open, closed)
The CSS:
#expandMenu {
background-color: #009cff;
opacity: 0.8;
height:65px;
width:100%;
display:none;
}
#menubar {
height:95px;
width: 100%;
color:#FFF;
}
#menubar:hover {
background-color:#0f0f0f;
transition: background-color 0.3s ease;
color:#FFF;
}
jQuery:
$(document).ready(function(e){
$("#pageTitle").click(function() { $('#expandMenu').slideToggle( "fast");
$('#menubar').css( "background-color", "#0f0f0f" ); } );
})
HTML:
<div id="menubar">
<div id="pageTitle">Start</div>
</div>
<div id="expandMenu">
</div>
I have created a fiddle here that I think captures your page pretty well. I have tweaked the css class for the menubar a little bit so that the text stays visible, but the main change I have made is adding a class to the #menubar rather than directly applying the new background color. Then when you are hiding the #expandMenu you can remove the class to go back to the original color, whatever it was.
I check whether the expandMenu is visible and adjust the classes accordingly:
if ($('#expandMenu').is(':visible'))
{
$('#menubar').removeClass('menu-active');
}
else
{
$('#menubar').addClass('menu-active');
}
I check this state before I toggle the menu item because the slideToggle takes some time to finish, and the div is not visible immediately after the call. Checking its state before applying the animation avoids this problem.

Text appear in zoom in effect

How can we show text in zoom in effect. I saw it on one travel site. I did google but cant find this kind of effect. I just want little hint what kind of effect is this. I red about easing but did not find the same effect. I have attached screenshot for the same. Here is link of that website http://cleartrip.com/flights?ui=v3. The effect is on payment page
Ok, so when you do something to make the section appear, the button within it animates from nothing to 100% size from its center point. So basically what you are asking is how to make something grow from 0% to 100% via animation. There's probably a totally javascript way but I personally would use css animation for this.
Suppose you are adding a class to the parent div to reveal a section of content (in the example you linked to it is revealing a section of the order form) all you need to do is in the css add an animation to the button that is triggered when the section gets a class added. In my example below I'm calling the section 'page' and assuming you're adding a class of 'active' to reveal it - obviously these could be anything you like:
Html:
<div class="page">
<div class="animated_button">Look at me</div>
[other content that you don't want to animate]
</div>
Css:
.page{
display:none;
}
.active{
display:block;
}
.animated_button{
[styling for how you want your button to look]
}
.active .animated_button{
animation: growUp 0.4s;
}
#keyframes growUp {
0% { transform:scale(0); }
100% { transform:scale(1); }
}
Note that you may need to add vendor-prefixes for the transforms.
Here is a codePen - there's a few extra styles and stuff in there just to show an example of how it works:
http://codepen.io/chrisboon27/pen/weJmL

Page to page fading effect

i need to implement load/unload page animations fade-in on load, and fade-out on unload.
1) I have read some articles about implementation it based on links clicks. That's does not work for me. I don't want to go that way, because some links should not open new page actually, and have href.
So imagine: link has properly href, but sometimes it open new page, sometimes not, based on it handler behavior. We add another handler that fire redirect all the time as timeout callback.
2) I can't implement animation using page unload event. I think it's right way.
Please help or advice something. Thank You!
Give your links you want to animate a class. Then you can use the .click() method to check when a link is clicked. Then do a preventDefault to stop the default behavior.
The next thing to do is check if there is "http" in the href attribute. You can get the value with $(this).attr('href');. If the link contains this, you need to go to a new page. For this, use window.location.href. Call this method as the callback of your fadeOut().
The only thing that is left is do a fade in when the page loads ;)
Actually i was finding the way without using links event, but using any UNLOAD event. Links events can be used only on a small website. In my case it created additional errors. For example some links, shouldn't do fade-out, and i don't know which of them actually.
So i don't recommend to do this. Need to find any UNLOAD page redirections animation way.
I'm not sure if I understand your question correctly..
Put this code in the pages' <head>s.
<style>
#keyframes page_transition
{
from {opacity: 0;}
to {opacity: 1;}
}
#-webkit-keyframes page_transition
{
from {opacity: 0;}
to {opacity: 1;}
}
html
{
animation: page_transition 1s ease-in-out;
-webkit-animation: page_transition 1s ease-in-out;
}
html.unloading
{
transition: opacity 500ms linear !important;
opacity: 0 !important;
}
</style>
<script>
window.addEventListener("beforeunload", function() {
document.documentElement.classList.add("unloading");
});
</script>

Categories