PDA

View Full Version : Animated Collapsible DIV and wordpress



buggerlugs
09-09-2008, 10:06 PM
1) Script Title: Animated Collapsible DIV v2.01

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

3) Describe problem:

Error: animatedcollapse is not defined

I have added the script to a wordpress blog and its works 100% fine on the page where my collapsible div is, but as soon as i navigate away from that page i get the error "Error: animatedcollapse is not defined", I guess because there is no div in the page (I only want it on one page) but the header info is still there because its in the header of a template file.

If I put the div on every page it wont show errors

Is there a way to fix this problem?

many thanks

ddadmin
09-10-2008, 06:32 AM
The script shoudn't return any errors actually if you just have the invocation code defined, but no actual corresponding DIVs. Please post a link to the page on your site that contains the problematic script so we can check it out.

buggerlugs
09-10-2008, 09:54 AM
unfortunately i cant post a link as its a site in development and the client doesnt want it made public.

The script code im my header is;

<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>
<script type="text/javascript" src="animatedcollapse.js">

/***********************************************
* Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script type="text/javascript">
animatedcollapse.addDiv('welcome','fade=10, speed=400, height=330px')
animatedcollapse.init()
</script>

The full header code in the template is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>
<script type="text/javascript" src="animatedcollapse.js">

/***********************************************
* Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script type="text/javascript">
animatedcollapse.addDiv('welcome','fade=10, speed=400, height=330px')
animatedcollapse.init()
</script>
<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="distribution" content="global" />
<meta name="robots" content="follow, all" />
<meta name="language" content="en, sv" />
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<!-- leave this for stats please -->

<link rel="Shortcut Icon" href="<?php echo get_settings('home'); ?>/wp-content/themes/PAD/images/favicon.ico" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php wp_head(); ?>
<style type="text/css" media="screen"><!-- @import url( <?php bloginfo('stylesheet_url'); ?> ); --></style>
</head>
<body>
<div id="wrap">
<div id="header">
<div class="headerleft">
<a href="<?php echo get_settings('home'); ?>/"><img src="<?php bloginfo('template_url'); ?>/images/logo.gif" alt="<?php bloginfo('name'); ?>" /></a></div>

<div class="headerright">
<b>Looking for something in particular?</b><br />
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" value="To search, type keywords and hit enter..." name="s" id="s-head" onfocus="if (this.value == 'To search, type keywords and hit enter...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type keywords and hit enter...';}" /></form>
</div>
</div>
<?php if (function_exists('suckerfish')) {suckerfish();} ?>

The output html is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>
<script type="text/javascript" src="animatedcollapse.js">

/***********************************************
* Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script type="text/javascript">
animatedcollapse.addDiv('welcome','fade=10, speed=400, height=330px')
animatedcollapse.init()
</script>
<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="distribution" content="global" />
<meta name="robots" content="follow, all" />
<meta name="language" content="en, sv" />
<title> PAD</title>
<meta name="generator" content="WordPress 2.6.1" />

<!-- leave this for stats please -->

<link rel="Shortcut Icon" href="http://www.removed.com/pad/wp-content/themes/PAD/images/favicon.ico" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://www.removed.com/pad/feed/" />
<link rel="alternate" type="text/xml" title="RSS .92" href="http://www.removed.com/pad/feed/rss/" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://www.removed.com/pad/feed/atom/" />
<link rel="pingback" href="http://www.removed.com/pad/xmlrpc.php" />
<link rel='archives' title='September 2008' href='http://www.removed.com/pad/2008/09/' />
<meta name='robots' content='noindex,nofollow' />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.removed.com/pad/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.removed.com/pad/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 2.6.1" />

<!-- Multi-level Navigation Plugin v1.0.6 by PixoPoint Web Development ... http://pixopoint.com/multi-level-navigation/ -->
<!--[if lte IE 6]><script type="text/javascript" src="http://www.removed.com/pad/wp-content/plugins/multi-level-navigation-plugin/suckerfish_ie.js"></script><![endif]-->

<link rel="stylesheet" type="text/css" href="http://www.removed.com/pad/wp-content/plugins/multi-level-navigation-plugin/style.php" />


<!-- GBCF -->
<link rel="stylesheet" type="text/css" media="screen" href="http://www.removed.com/pad/wp-content/plugins/wp-gbcf/wp-gbcf_themes/default.css" />
<!--[if IE]><script src="http://www.removed.com/pad/wp-content/plugins/wp-gbcf/wp-gbcf_focus.js" type="text/javascript"></script><![endif]-->
<!-- GBCF -->

<style type="text/css" media="screen"><!-- @import url( http://www.removed.com/pad/wp-content/themes/pad/style.css ); --></style>
</head>

I checked that i can include almost all of the header script but its this specific part that makes an error on pages without a div:


<script type="text/javascript">
animatedcollapse.addDiv('welcome', 'fade=0,speed=400, 'height=330px')
animatedcollapse.init()
</script>

Jayhpm
01-29-2010, 07:56 PM
Here's a Wordpress plugin that you can install in your Wordpress blog which allows you to search and fetch free stock photos. It's a stock images plugin (http://wordpress.org/extend/plugins/freebie-images-free-stock-images-plugin/) from Crestock.com which lets you to just drag and drop the selected image to your post with any copyright issues or whatsoever. Thought of mentioning as it might be of help.
Cheers!