MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

Archive for the ‘JQuery’ Category

Copy to Clipboard – a browser agnostic way to script this functionality

Posted by Venkatt Guhesan on October 31, 2011

Have you tried to present some code or sample content for the end-user that you wanted to allow them to easily copy to their clip-board?

If you use the JQuery Javascript library then you can use the plugin called zClip available here – zClip

Using zclip you can attach an event to a button or a text-area such that when the event occurs, the content is copied to the clipboard.

Well, if you are not using JQuery as the swiss-army knife for your Javascript toolkit, then here is an alternative that can come in handy:

It’s called “ZeroClipboard” and it’s available from code.google.com

Both tools do the following, they replace or overlay a flash plugin on top which then passes the needed content to the native clipboard. Both solutions do not have a graceful way to do copy to clipboard especially if you do not have flash enabled or installed for your platform – browser.

As the browser matures, maybe this functionality might be allowed natively from a Javascript code but until then, the ZeroClipboard and zClip are the best ways to implement a “copy-to-clipboard”.

 

Posted in Javascript, JQuery | Tagged: , , , , , , | Leave a Comment »

jQuery Accordian Internet Explorer 6 Issue

Posted by Venkatt Guhesan on January 19, 2010

If you are using the Accordian UI from jQuery and your accordion body (the content in div.ui-accordion-content tag) contains anchor tags then you might experience a few glitches in IE6 where the display might not render properly when selected.

One way to address this issue is the following:
Add this to the header…


<style>
.ui-accordion-content{ zoom: 1; }
</style>

This will force a refresh of the content when expanded.

The other thing that you may not have is a doctype defined in the header.

Here’s an example of a DOCTYPE defined:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
...

Recommended list of DOCTYPES available.

If you find this article useful, consider signing up for my RSS feed or Email Newsletter. See links on the right side.

Posted in Javascript, JQuery | Leave a Comment »