Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi i used this example (demo 6 but unable to find error please help)?

i want to use demo 6 but unable to do that..

http://www.aakashweb.com/resources/pages/demos/jquery-collapser/[^]ollapser/">http://www.aakashweb.com/resources/pages/demos/jquery-collapser/[^]ollapser/">http://www.aakashweb.com/resources/pages/demos/jquery-collapser/[^][^][^]

XML
<!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 src="jquery.collapser.min.js" type="text/javascript"></script>
<script src="jquery.collapser.js" type="text/javascript"></script>
 <script src="jquery.collapser.min.js" type="text/javascript"></script>
    <script src="jquery.min.js" type="text/javascript"></script>
<head>
    <title>Expand table rows with jQuery - jExpand plugin - JankoAtWarpSpeed demos</title>
    <style type="text/css">
       .demo6{
    border: 1px solid #B9E3FF;
    background: #0099FF;
    padding-left: 5px;
    color: #FFFFFF;
}
    </style>

    <script type="text/javascript">

$('.panel').hide();

$('.demo6').collapser({
    target: 'next',
    effect: 'slide',
    changeText: 0,
    expandClass: 'expIco',
    collapseClass: 'collIco'
}, function(){
    $('.panel').slideUp();
});


    </script>
</head>
<body>
 <h4 class="demo6">Heading 1</h4>
<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

<h4 class="demo6">Heading 2</h4>
<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

<h4 class="demo6">Heading 3</h4>
<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

<h4 class="demo6">Heading 4</h4>
<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

</body>
</html>









Thanks
Posted
Comments
ravinsit89 15-Sep-12 4:48am    
error is coming jquery is undefined
ravinsit89 15-Sep-12 5:29am    
Hi
this time i get error


: The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.


<html xmlns="http://www.w3.org/1999/xhtml" >
<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.collapser.js" type="text/javascript"></script>

<head>
<title>Expand table rows with jQuery - jExpand plugin - JankoAtWarpSpeed demos</title>
<style type="text/css">
.demo6{
border: 1px solid #B9E3FF;
background: #0099FF;
padding-left: 5px;
color: #FFFFFF;
}
</style>

<script type="text/javascript">

$('.panel').hide();

$('.demo6').collapser({
target: 'next',
effect: 'slide',
changeText: 0,
expandClass: 'expIco',
collapseClass: 'collIco'
}, function(){
$('.panel').slideUp();
});


</script>
</head>
<body>

Heading 1


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 2


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 3


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 4


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

</body>
</html>

1 solution

You must include the "jquery.min.js" script file first, before "jquery.collapser.min.js" - the other jQuery file is a plugin and requires the main jQuery file to work.

Also, "jquery.collapser.min.js" should be the same as "jquery.collapser.js", but minified to take up less space. You only need to include one of them, and only once.
 
Share this answer
 
Comments
AmitGajjar 15-Sep-12 5:27am    
Not sure but javascript file order is not correct 5+,
ravinsit89 15-Sep-12 5:41am    
Error is this Now

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
Graham Breach 15-Sep-12 5:47am    
Then you should add the correct character encoding in the document or in the transfer protocol.

See http://www.w3.org/International/questions/qa-html-encoding-declarations for details
ravinsit89 15-Sep-12 5:57am    
Every think is fine but it not look like as in demo 6 ..

http://www.aakashweb.com/resources/pages/demos/jquery-collapser/

i think script is not running...
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<head>

<title>Expand table rows with jQuery - jExpand plugin - JankoAtWarpSpeed demos</title>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.collapser.js" type="text/javascript"></script>
<script src="jquery.collapser.min.js" type="text/javascript"></script>


<style type="text/css">
.demo6{
border: 1px solid #B9E3FF;
background: #0099FF;
padding-left: 5px;
color: #FFFFFF;
}
</style>

<script type="text/javascript">
alert("Hi");
$('.panel').hide();

$('.demo6').collapser({
target: 'next',
effect: 'slide',
changeText: 0,
expandClass: 'expIco',
collapseClass: 'collIco'
}, function(){
$('.panel').slideUp();
});


</script>
</head>
<body>

Heading 1


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 2


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 3


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

Heading 4


<div class="panel">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>

</body>
</html>
Graham Breach 15-Sep-12 6:06am    
You've included the plugin twice again, so that could prevent the rest of the script from working. Apart from that, you're calling the jQuery functions directly in the header before the DOM has loaded, which is too early - you have to use the $(document).ready() callback or something similar.

I suggest you read through the jQuery tutorial before going any further: http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900