sinsysonline
12-06-2012, 08:35 PM
Greetings All,
I've been having trouble combining 2 scripts and to have them automatically preform them both at the same time.
I have one script that is a simple slideshow that loads dynamic text into a DIV every 5 seconds.
The next script edits the SPAN of the text to resize according to the character amount. The text it pulls can be any length and it simply edits the font size to force the post to fill the entire static box.
How can I get this resizing script to run in parallel right after the slide switches? Should I combine them into one script? Or should I just also set it to an interval of 5 seconds (and how would I do that?)
Script 1 - Slideshow:
[CODE]
<script>
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 5000);
</script>
[CODE]
Script 2 - Resize Text
[CODE]
<script>
$(function resize() {
$('#slideshow span').css('font-size', '4em');
while( $('#slideshow span').height() > $('#slideshow').height() ) {
$('#slideshow span').css('font-size', (parseInt($('#slideshow span').css('font-size')) - 1) + "px" );
}
});
</script>
[CODE]
I've been having trouble combining 2 scripts and to have them automatically preform them both at the same time.
I have one script that is a simple slideshow that loads dynamic text into a DIV every 5 seconds.
The next script edits the SPAN of the text to resize according to the character amount. The text it pulls can be any length and it simply edits the font size to force the post to fill the entire static box.
How can I get this resizing script to run in parallel right after the slide switches? Should I combine them into one script? Or should I just also set it to an interval of 5 seconds (and how would I do that?)
Script 1 - Slideshow:
[CODE]
<script>
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 5000);
</script>
[CODE]
Script 2 - Resize Text
[CODE]
<script>
$(function resize() {
$('#slideshow span').css('font-size', '4em');
while( $('#slideshow span').height() > $('#slideshow').height() ) {
$('#slideshow span').css('font-size', (parseInt($('#slideshow span').css('font-size')) - 1) + "px" );
}
});
</script>
[CODE]