Kenet
10-13-2008, 08:42 PM
1) Script Title: Ajax Tabs Content Script (v 2.2)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm
3) Describe problem: Having a problem loading and initializing external Javascript.
I am using Ajax Tabs and I need to be able to load and execute upon load a small Jquery script that creates a dropcap on the first paragraph of my content.
I have read the following.... most of it makes my head spin...
http://www.dynamicdrive.com/forums/showthread.php?t=13003
http://www.dynamicdrive.com/forums/showthread.php?t=17426
and
http://www.dynamicdrive.com/forums/showthread.php?t=27400
The script I am trying to use is this:
<script type="text/javascript">
$(document).ready(function(){
swap_letter();
});
function swap_letter() {
var first_paragraph = $('div.drop-cap p')[0];
if (!first_paragraph) return false;
var node = first_paragraph;
while (node.childNodes.length) {
node = node.firstChild;
}
var text = node.nodeValue;
var first_letter = text.substr(0,1);
var match = /[a-zA-Z]/.test(first_letter);
if ( match ) {
node.nodeValue = text.slice(1);
$('<img />')
.attr('src','images/alphabet/' + first_letter.toLowerCase() + '.png')
.attr('alt',first_letter)
.addClass('fancy-letter')
.prependTo( first_paragraph );
}
}
</script>
And I know I need to add a polling event... I'm just not sure how.
Thanks
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm
3) Describe problem: Having a problem loading and initializing external Javascript.
I am using Ajax Tabs and I need to be able to load and execute upon load a small Jquery script that creates a dropcap on the first paragraph of my content.
I have read the following.... most of it makes my head spin...
http://www.dynamicdrive.com/forums/showthread.php?t=13003
http://www.dynamicdrive.com/forums/showthread.php?t=17426
and
http://www.dynamicdrive.com/forums/showthread.php?t=27400
The script I am trying to use is this:
<script type="text/javascript">
$(document).ready(function(){
swap_letter();
});
function swap_letter() {
var first_paragraph = $('div.drop-cap p')[0];
if (!first_paragraph) return false;
var node = first_paragraph;
while (node.childNodes.length) {
node = node.firstChild;
}
var text = node.nodeValue;
var first_letter = text.substr(0,1);
var match = /[a-zA-Z]/.test(first_letter);
if ( match ) {
node.nodeValue = text.slice(1);
$('<img />')
.attr('src','images/alphabet/' + first_letter.toLowerCase() + '.png')
.attr('alt',first_letter)
.addClass('fancy-letter')
.prependTo( first_paragraph );
}
}
</script>
And I know I need to add a polling event... I'm just not sure how.
Thanks