Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:44:47+00:00 2026-06-13T10:44:47+00:00

I’d like to add a slide & fade effect to a DIV, with purely

  • 0

I’d like to add a slide & fade effect to a DIV, with purely Javascript, using “onclick”.

The code is here: http://jsfiddle.net/TCUd5/

The DIV that has to slide has id=”pulldown_contents_wrapper”.
This DIV is contained in a SPAN, that also triggers it:

<span onclick="toggleUpdatesPulldown(event, this, '4');" style="display: inline-block;" class="updates_pulldown" >
    <div class="pulldown_contents_wrapper" id="pulldown_contents_wrapper">

And I think the JS code that controls the SPAN onclick is:

var toggleUpdatesPulldown = function(event, element, user_id) {
  if( element.className=='updates_pulldown' ) {
    element.className= 'updates_pulldown_active';
    showNotifications();
  } else {
    element.className='updates_pulldown';
  }  
}

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).

I have tried to implement the code from: why javascript onclick div slide not working? but with no results.

Thanks a lot.

I have managed to make it with Mootools, but I can’t figure it out how to add a slide & fade effect, and a delay on mouseout

    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();
  }

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:44:48+00:00Added an answer on June 13, 2026 at 10:44 am

    jQuery is a lot easier, but with pure javascript you can do it.

    In the CSS you’ll need to use transitions

    #thing { position:relative;
      top: 0px;
      opacity: 0.8;
      -moz-transition: top 1s linear, opacity 1s linear;
      -webkit-transition: top 1s linear, opacity 1s linear;
     }
    

    then in the javascript when you change the position of the element, it should change via the css transitions.

    var toggleUpdatesPulldown = function(event, element, user_id) {
      if( element.className=='updates_pulldown' ) {
         element.style.top = someValue; //something like '100px' will slide it down 100px
         element.style.opacity = '1.0'; //will fade the content in from 0.8 opacity to 1.0
         element.className= 'updates_pulldown_active';
        showNotifications();
    

    EDIT – provided jQuery code

    call the jQuery library, most easily done from the google hosting

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    

    make the hover function

    $(document).ready(function() {
            $('.updates_pulldown').hover( //first function is mouseon, second is mouseout
                function() {
                    $(this).animate({top: '50px'}).animate({opacity: '1.0'});
                },
                function() { //delay 1000 milliseconds, animate both position and opacity
                    $(this).delay(1000).animate({top: '0px'}).animate({opacity: '0.5'});
                }
            )
        })
    

    the function timing will be the same as whatever you set it to in the css with transition tags. using ‘this’ instead of the class name again makes sure that the effect only occurs on the specific instance of the class that is hovered over. im not sure if this animation is exactly what you were asking for, but if i understand the question correctly then the main functionality will work for you. just change the numbers and such to fit your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.