Javascript code for folding the QQ panel with buffering effect-javascript skills

Source: Internet
Author: User
This article mainly introduces the QQ-like panel folding menu code of JavaScript with buffering effect, and implements the folding menu buffering effect through the recursive call of JavaScript timing function, which has some reference value, for more information about how to use JavaScript to implement the QQ panel folding menu code with buffering effect, see the examples in this article. Share it with you for your reference. The details are as follows:

QQ-like panel folding menu code with buffering Effect. Usage: Call Effect: Effect );
1 indicates the id of the object to be changed.
Where 2 is: the control container id can be obtained by using: this. parentNode. id (parent tag id)

Note: Do not repeat the Object ID.

Shows the running effect:

The Online Demo address is as follows:

Http://demo.jb51.net/js/2015/js-buffer-style-qq-menu-codes/

The Code is as follows:

QQ-like panel folding menu code with buffering effectScript function $ G (Read_Id) {return document. getElementById (Read_Id)} function Effect (ObjectId, parentId) {var Obj_Display = $ G (ObjectId ). style. display; if (Obj_Display = 'None') {Start (ObjectId, 'opens'); $ G (parentId ). innerHTML = "-"} else {Start (ObjectId, 'close'); $ G (parentId ). innerHTML = "+"} function Start (ObjId, method) {var BoxHeight = $ G (ObjId ). offsetHeight; // obtain the object height var MinHeight = 5; // define the minimum object height var MaxHeight = 130; // define the maximum object height var BoxAddMax = 1; // The initial value of the incremental value var Every_Add = 0.15; // each hand (minus) Increment [the greater the value, the faster the speed] var Reduce = (BoxAddMax-Every_Add ); var Add = (BoxAddMax + Every_Add); // Close the action ** if (method = "Close") {var Alter_Close = function () {// construct a virtual [Descending] cyclic BoxAddMax/= Reduce; BoxHeight-= BoxAddMax; if (BoxHeight <= MinHeight) {$ G (ObjId ). style. display = "none"; window. clearInterval (BoxAction);} else $ G (ObjId ). style. height = BoxHeight;} var BoxAction = window. setInterval (Alter_Close, 1);} // open the action * else if (method = "Opens") {var Alter_Opens = function () {BoxAddMax * = Add; boxHeight + = BoxAddMax; if (BoxHeight> = MaxHeight) {$ G (ObjId ). style. height = MaxHeight; window. clearInterval (BoxAction);} else {$ G (ObjId ). style. display = "block"; $ G (ObjId ). style. height = BoxHeight;} var BoxAction = window. setInterval (Alter_Opens, 1) ;}} script

  • +
  • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu


  • +
  • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu
    • Buffer menu


  • +
  • Buffer menu
    • Buffer menu
    • Buffer menu


  • +
  • Buffer menu
    • Buffer menu
    • Buffer menu


  • +
  • Buffer menu
    • Buffer menu
    • Buffer menu

    I hope this article will help you design JavaScript programs.

    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.