简体   繁体   English

如何使用jQuery扩展折叠切换div层

[英]how to expand collapse toggle div layer using jquery

i try to use the following tutorial How to expand collapse (toggle) div layer using jQuery 我尝试使用以下教程如何使用jQuery展开折叠(切换)div层

it is working perfect in index.html file but i want to add the code into the following template 它在index.html文件中工作正常,但我想将代码添加到以下模板中

<!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">
<head>
<meta http-equiv="content-type" content="text/html; charset={$charset}" />
<title>{$companyname} - {$pagetitle}{if $kbarticle.title} - {$kbarticle.title}{/if}</title>
{if $systemurl}<base href="{$systemurl}" />
{/if}
{if $LANG.stylearabic == 'stylearabic'}
<link rel="stylesheet" type="text/css" href="templates/{$template}/style-arabic.css" />
<link rel="stylesheet" type="text/css" href="ads/ads.css" />    
{else}
<link rel="stylesheet" type="text/css" href="templates/{$template}/style.css" />
<link rel="stylesheet" type="text/css" href="ads/ads.css" />    
{/if}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery(".content").hide();
  //toggle the componenet with class msg_body
  jQuery(".heading").click(function()
  {
    jQuery(this).next(".content").slideToggle(500);
  });
});
</script>
<script type="text/javascript" src="includes/jscript/jquery.js"></script>

{if $livehelpjs}{$livehelpjs}
{/if}</head>
<body>
<div class="layer1">
<p class="heading"><img border="0" src="ads/Y-bar.png" width="500" height="30"></p>
<div class="content"><img border="0" src="ads/big.jpg" width="500" height="500">
</div>
</div>
<div id="top_container">
  <div id="top">
    <div id="company_title">{$companyname}</div>
    <div id="welcome_box">{if $loggedin}{$LANG.welcomeback}, <strong>{$loggedinuser.firstname}</strong>&nbsp;&nbsp;&nbsp;<img src="templates/{$template}/images/icons/details.gif" alt="{$LANG.clientareanavdetails}" width="16" height="16" border="0" class="absmiddle" /> <a href="clientarea.php?action=details" title="{$LANG.clientareanavdetails}"><strong>{$LANG.clientareanavdetails}</strong></a>&nbsp;&nbsp;&nbsp;<img src="templates/{$template}/images/icons/logout.gif" alt="{$LANG.logouttitle}" width="16" height="16" border="0" class="absmiddle" /> <a href="logout.php" title="Logout"><strong>{$LANG.logouttitle}</strong></a>{else}{$LANG.please} <a href="clientarea.php" title="{$LANG.loginbutton}"><strong>{$LANG.loginbutton}</strong></a> {$LANG.or} <a href="register.php" title="{$LANG.clientregistertitle}"><strong>{$LANG.clientregistertitle}</strong></a>{/if}</div>
  </div>
</div>
<div id="content_container">
{if $loggedin}
  <div id="top_menu">
    <ul>
      <li><a href="clientarea.php" title="{$LANG.clientareanavhome}">{$LANG.clientareanavhome}</a></li>
      <li><a href="clientarea.php?action=details" title="{$LANG.clientareanavdetails}">{$LANG.clientareanavdetails}</a></li>
      <li><a href="clientarea.php?action=products" title="{$LANG.clientareanavservices}">{$LANG.clientareanavservices}</a></li>
      <li><a href="clientarea.php?action=domains" title="{$LANG.clientareanavdomains}">{$LANG.clientareanavdomains}</a></li>
      <li><a href="clientarea.php?action=quotes" title="{$LANG.quotestitle}">{$LANG.quotestitle}</a></li>
      <li><a href="clientarea.php?action=invoices" title="{$LANG.invoices}">{$LANG.invoices}</a></li>
      <li><a href="supporttickets.php" title="{$LANG.clientareanavsupporttickets}">{$LANG.clientareanavsupporttickets}</a></li>
      <li><a href="affiliates.php" title="{$LANG.affiliatestitle}">{$LANG.affiliatestitle}</a></li>
      <li><a href="clientarea.php?action=emails" title="{$LANG.clientareaemails}">{$LANG.clientareaemails}</a></li>
    </ul>
    <div class="clear"></div>
  </div>
{/if}
  <div id="content_left">
    <h1>{$pagetitle}</h1>
    <p class="breadcrumb">{$breadcrumbnav}</p>

i got the following error at IE8 , also not working in any browsers 我在IE8上收到以下错误,也无法在任何浏览器中使用

Webpage error details

Message: Expected '{'
Line: 11
Char: 35
Code: 0

how can i made this work ? 我该如何进行这项工作?

thanks 谢谢

以下教程适用于模板引擎代码, 可扩展,可折叠的切换窗格jquery

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM