سؤال

I have used copy to clipboard functionality with the help of this:

function clipboard(control, url, key) {

        ZeroClipboard.setMoviePath('http://davidwalsh.name/dw-content
                                    /ZeroClipboard.swf');
        //create client
        var clip = new ZeroClipboard.Client();


        clip.setText(control.textContent);

        clip.addEventListener('complete', function (client, text) {

            alert('copied: ' + text);
            CheckIPAddress(key);
            window.open(url, '_blank');
        });
        //glue it to the button

        clip.reposition('GridView1_ctl03_lnk');

        clip.glue(control);

    }

Till now, it works fine.

But when that control change it's position due to sliding feature, the control keep glued on the original as well as the new position.

So is there a way such that when that control change it's position then keep glued on the new position and get removed from the old position.

Thanks in advance.

هل كانت مفيدة؟

المحلول

t is highly recommended you create a "container" DIV element around your button, set its CSS "position" to "relative", and place your button just inside. Then, pass two arguments to glue(), your button DOM element or ID, and the container DOM element or ID. This way Zero Clipboard can position the floating Flash movie relative to the container DIV (not the page body), resulting in much more exact positioning. Example (HTML):

    <div id="d_clip_container" style="position:relative">
     <div id="d_clip_button")Copy to Clipboard</div>
      </div>

And the code:

clip.glue( 'd_clip_button', 'd_clip_container' );

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top