Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="button">Click Me</div>
- <div class="to_change"></div>
- $(function(){
- var button = $('.button')
- var to_change = $('.to_change');
- $(window).on('custom_trigger', function(){
- button.trigger('click');
- })
- //when the button is clicked, run the animation
- button.click(function(){
- to_change.html('new div text')
- .fadeIn({duration: 2000, queue: 'performance'})
- .delay(5000, 'performance')
- .fadeOut({duration: 2000, queue: 'performance'})
- .queue('performance', function(next){
- console.log('performance done');
- $(window).trigger('custom_trigger');
- next();
- })
- .dequeue('performance')
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement