Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript slide effect onclick
    primarykey
    data
    text
    <p>I'd like to add a slide &amp; fade effect to a DIV, with purely Javascript, using "onclick".</p> <p>The code is here: <a href="http://jsfiddle.net/TCUd5/" rel="nofollow noreferrer">http://jsfiddle.net/TCUd5/</a></p> <p>The DIV that has to slide has id="pulldown_contents_wrapper". This DIV is contained in a SPAN, that also triggers it:</p> <pre><code>&lt;span onclick="toggleUpdatesPulldown(event, this, '4');" style="display: inline-block;" class="updates_pulldown" &gt; &lt;div class="pulldown_contents_wrapper" id="pulldown_contents_wrapper"&gt; </code></pre> <p>And I think the JS code that controls the SPAN onclick is:</p> <pre><code>var toggleUpdatesPulldown = function(event, element, user_id) { if( element.className=='updates_pulldown' ) { element.className= 'updates_pulldown_active'; showNotifications(); } else { element.className='updates_pulldown'; } } </code></pre> <p>If it is not possible to make it with pure JS, do you have an idea how could I do it with Mootools? (*I'd like to use only pure JS or the Mootols framework).</p> <p>I have tried to implement the code from: <a href="https://stackoverflow.com/questions/1702266/why-javascript-onclick-div-slide-not-working">why javascript onclick div slide not working?</a> but with no results.</p> <p>Thanks a lot.</p> <p>I have managed to make it with Mootools, but I can't figure it out how to add a slide &amp; fade effect, and a delay on mouseout</p> <pre><code> window.addEvent('domready', function() { $('updates_pulldown').addEvents({ mouseenter: function(){ $('updates_pulldown').removeClass('updates_pulldown').addClass('updates_pulldown_active') $('pulldown_contents_wrapper').set('tween', { duration: 1000, physics: 'pow:in:out', transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out' }).show(); }, mouseleave: function(){ $('pulldown_contents_wrapper').set('tween', { duration: 1000, delay: 1000, }).hide(); $('updates_pulldown').removeClass('updates_pulldown_active').addClass('updates_pulldown') }, }); }); var toggleUpdatesPulldown = function(event, element, user_id) { showNotifications(); } </code></pre> <p>Any idea?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload