Background color property slide up

前端 未结 2 388
夕颜
夕颜 2021-01-28 11:46

The question is in in transitionBackground function. In this case, the function triggers when the up button is pressed on the page.

    
    

        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-28 12:09

    Instead of the if statement you'll probably want to use jQuery's .toggle() function as it will allow you to toggle between multiple options, in this case your bg colors. You can't have the green slide up on the blue with one . You need to create a second div and set the display to none. Then onclick toggle between the two layers by using the slide and hide functions.

    
    

    This probably won't run if used verbatim, but should provide you a starting point at least. I'd review the documentation on jquery.com.

提交回复
热议问题