0
I’m using an effect of Full Screen Overlay in my website, this effect I caught on Codrops. It is working normal though, as I am searching for data in the BD, how to make it work not only on one button, but as several?
JS:
(function() {
var triggerBttn = document.getElementById('menudrops'),
overlay = document.querySelector( 'div.overlay' ),
closeBttn = overlay.querySelector( 'p.overlay-close' );
transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd',
'transition': 'transitionend'
},
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
support = { transitions : Modernizr.csstransitions };
s = Snap( overlay.querySelector( 'svg' ) ),
path = s.select( 'path' ),
steps = overlay.getAttribute( 'data-steps' ).split(';'),
stepsTotal = steps.length;
function toggleOverlay() {
if( classie.has( overlay, 'open' ) ) {
var pos = stepsTotal-1;
classie.remove( overlay, 'open' );
classie.add( overlay, 'close' );
var onEndTransitionFn = function( ev ) {
classie.remove( overlay, 'close' );
},
nextStep = function( pos ) {
pos--;
if( pos < 0 ) return;
path.animate( { 'path' : steps[pos] }, 60, mina.linear, function() {
if( pos === 0 ) {
onEndTransitionFn();
}
nextStep(pos);
} );
};
nextStep(pos);
}
else if( !classie.has( overlay, 'close' ) ) {
var pos = 0;
classie.add( overlay, 'open' );
var nextStep = function( pos ) {
pos++;
if( pos > stepsTotal - 1 ) return;
path.animate( { 'path' : steps[pos] }, 60, mina.linear, function() { nextStep(pos); } );
};
nextStep(pos);
}
}
triggerBttn.addEventListener( 'click', toggleOverlay );
closeBttn.addEventListener( 'click', toggleOverlay );
})();
PHP:
<section>
<p id="menudrops">'.$titulo.'</p>
</section>
Your link shows a page with
DESCULPE, ESSA PÁGINA NÃO EXISTE
. You can be clearer in the question explaining the effect you want? I saw the other link too but I didn’t realize what effect you want. Put your code here too so we can help.– Sergio
@Sergio changed the link, the effect I want is this : http://tympanus.net/Development/FullscreenOverlayStyles/index12.html by clicking on the "open overlay" button he makes the animation, in my case it is the text below the photo, when clicking on the link he makes this efficiency, only that it works only once
– Furlan
For this purpose you need this plugin? Isn’t it easier to create a field with display None with the content you want to present on the screen and then fade with js? you would have the same effect dynamically, could control easier content and triggers to activate this effect
– RodrigoBorth
You have the same ID on all elements... ID’s are unique, can not be duplicated.
– Sergio
@Rodrigoborth but it would have to have that effect, go up and zoom in, like you could do?
– Furlan
you can do with Animate, put possition Absolute and bottom 0; then an Animate to height 100% and join with a fadein that will get the same effect
– RodrigoBorth
fuck I have no knowledge in js, you can help me to mount in jsfiddle ?
– Furlan
actually I think you can not use the fadein and the Animate at the same time, but you can use the Animate since the background has opacity the effect is very similar
– RodrigoBorth
I’ll see if I can set up a quick one here and send you
– RodrigoBorth
OK, vlw @Rodrigoborth
– Furlan
http://jsfiddle.net/ZPjxu/1/
– RodrigoBorth
js fiddle does not work, but if you move to a file you can see working
– RodrigoBorth
and it also became very simple to understand the logic
– RodrigoBorth
could not rotate
– Furlan
as I said, fiddle does not work because it does not accept, some CSS attributes as position for example, put the answer, passes it to a file that you will be able to run well
– RodrigoBorth