SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    437
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    trouble with using ZeroClipboard and add a tooltip

    Hi, I'm trying to use Zeroclipboard
    Code:
    http://code.google.com/p/zeroclipboard/
    to copy stuff to the clipboard and add a tooltip when the mouse hover on the flash. but it doesn't seem to be working.
    my html code:

    Code:
    <div rel="<?php echo $url;?>" class="cp-code">copied code</div>
    <div class="test" style="display: none; border: 1px solid #ccc; padding: 8px;">click copy,test,test</div>

    My js code: i have added the jquery library.

    Code:
    ZeroClipboard.setMoviePath("http://example.com/js/ZeroClipboard.swf");
    var clip = null;
    var url = '';
    
    function init() {
        clip = new ZeroClipboard.Client();
        clip.setHandCursor( true );
    
        $('.cp-code').mouseover( function() {
            clip.setText(this.innerHTML);
                 $('test').style.display = 'block';
            if (clip.div) {
                clip.receiveEvent('mouseout', null);
                clip.reposition(this);
            } else {
                            clip.glue(this);
                    }
            clip.receiveEvent('mouseover', null);
            url = $(this).attr('rel');
        });
    
        clip.addEventListener('mouseUp', function(client) {
            window.open(url);
        });
    clip.addEventListener('mouseOut', function (client) {
     $('test').style.display = 'none'; 
    });
    }
    
    $(document).ready(function() {
    	init();
    });

  2. #2
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    437
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    anyone helps?

  3. #3
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    437
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    anyone helps? thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •