topical media & game development
graphic-canvas-util-beautytips-demo-demofiles-demo.js / js
Fancy script sets up the page and runs the code in the div.js elements
$(function(){
$('div.example').each(function() {
var target = $('.target, .alt-target', this);
var htmlSource = $('<div />').append(target.clone()).html();
htmlSource = $('<div class="html-source">' + escapeHTMLEncode(htmlSource) + '</div>');
var html = $('<div class="html-link"><a href="#">html</a></div>').click(function(){
if (.browser.msie) {
this.parent().find('.js').toggle();
}
else {
this.parent().find('.js').slideToggle();
}
return false;
});
var cssSource = $('style', this);
if (cssSource.length) {
cssSource = $('<div class="css-source">' + cssSource.html() + '</div>');
var css = $('<div class="css-link"><a href="#">css</a></div>').click(function(){
if (textarea = $('textarea', obj);
textarea.get(0).scrollHeight || 50;
$('textarea', obj).css({height: scrollHeight});
}
function escapeHTMLEncode(str) {
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.