Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#sidebar .myxpress_promote').hover(function(){
- start_bubbles();
- }, function(){
- window.clearTimeout(h);
- });
- function start_bubbles() {
- new heart();
- h = window.setTimeout(start_bubbles, 500);
- }
- function heart() {
- this.parent = $('#sidebar .myxpress_promote');
- this.element = $('<span class="heart">♥</span>');
- this.parent.append(this.element);
- this.x = Math.floor(Math.random() * this.parent.width() + 20);
- this.y = - ( Math.floor(Math.random()*this.element.height()) -10 );
- this.ticks = 0;
- this.size = Math.floor(Math.random() * 30 + 8);
- this.element.css({
- 'font-size' : this.size + 'px',
- 'left' : this.x + 'px',
- 'bottom' : this.y + 'px'
- });
- this.tick = function() {
- this.y += this.size / 30;
- this.element.css({
- 'left': Math.sin(this.ticks / 10.0) * this.size / 15.0 + this.x - this.element.width() / 1.0 + 'px',
- 'bottom': this.y + 'px'
- });
- this.ticks++;
- this.update = window.setTimeout(update_heart, 20, this);
- }
- this.tick();
- this.element.fadeOut({ duration: 6000, queue: false }, "easeOut");
- }
- function update_heart(hrt) {
- hrt.tick();
- if(hrt.element.css("display")=="none") {
- hrt.element.remove();
- window.clearTimeout(hrt.update);
- }
- }
Add Comment
Please, Sign In to add comment