<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Prabeen&#039;s Blog</title>
	<atom:link href="http://prabeengiri.com.np/feed" rel="self" type="application/rss+xml" />
	<link>http://prabeengiri.com.np</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 17 Aug 2010 09:54:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Storing and displaying the image stored as varbinary in  MSSQL server using PHP (CodeIgniter)</title>
		<link>http://prabeengiri.com.np/php/stroring-and-displaying-the-image-stored-as-varbinary-in-mssql-server-using-php-codeigniter.html</link>
		<comments>http://prabeengiri.com.np/php/stroring-and-displaying-the-image-stored-as-varbinary-in-mssql-server-using-php-codeigniter.html#comments</comments>
		<pubDate>Mon, 05 Jul 2010 13:11:53 +0000</pubDate>
		<dc:creator>Prabeen</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[MSSQL Server]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://prabeengiri.com.np/?p=593</guid>
		<description><![CDATA[Storing and displaying the image stored as varbinary in  MSSQL server using PHP (CodeIgniter), display files in browser , MSSQL server datatype varbinary(MAX), msssql server and codeigniter display images.   ]]></description>
			<content:encoded><![CDATA[<p>I am not used to MSSql server with php . MSSQL server has very less documentation compared to Mysql . So here I am writing a short snippets to upload image to MSSQL server in field type &#8216;varbinary&#8217; and display the image to browser using php framework <a href="http://codeigniter.com/">codeIgniter</a>. Using framework for php application development is always a good idea.<span id="more-593"></span></p>
<p>Here is a php snippet  to  store the uploaded image in the MSSQL server ( datatype = varbinay(MAX)) .</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> do_upload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload_path'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./uploads/'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allowed_types'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'gif|jpg|png'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_size'</span><span style="color: #009900;">&#93;</span>	<span style="color: #339933;">=</span> <span style="color: #0000ff;">'100'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_width'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1024'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_height'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'768'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">upload</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">do_upload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">upload</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_errors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_form'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>	
		<span style="color: #b1b100;">else</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">upload</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
                        <span style="color: #000088;">$dataString</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'full_path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000088;">$arrData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unpack</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H*hex&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dataString</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000088;">$data_string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0x&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$arrData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hex'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">// now we can insert the $data_string variable into the sql server using it respective sql query.</span>
			delete_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'full_path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// we don't want the image to be stored in the web server. </span>
                        <span style="color: #666666; font-style: italic;">//$this-&gt;load-&gt;view('upload_success', $data);</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now its little tricky to render the image in the browser that is stored in the MSSQL server ,varbinary(MAX) datatype.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEURL'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>display_image/convert_image/$row-&gt;id?&gt; width=&quot;74&quot; height=&quot;53&quot; /&gt;
&nbsp;
// baseurl returns the base_url().'index.php/'  (my custom config) 
// display_image is controller name  
// convert_image is method name 
//$row-&gt;id returns the primary key of that particular image row.It is used for query to the database.</pre></div></div>

<p>Now here is my controller to render image on the browser .</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Display_Image <span style="color: #000000; font-weight: bold;">extends</span> Controller
<span style="color: #009900;">&#123;</span> 
	<span style="color: #000000; font-weight: bold;">function</span> Display_Image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span> 
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> 
	<span style="color: #000000; font-weight: bold;">function</span> convert_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span> 
&nbsp;
		<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span>  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">my_model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">segment</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// to get the image data from the database where my_model is model to fetch the row. </span>
                <span style="color: #000088;">$image_data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">image</span><span style="color: #339933;">;</span> 
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: image/jpeg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// to tell browser that content type is jpeg image.  </span>
		<span style="color: #b1b100;">print</span> <span style="color: #000088;">$image_data</span><span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #009900;">&#125;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This is how we can store and display image using MSSQL server in datatype varbinary (MAX).<br />
I hope this information is helpful who are having hard time to find the solution . </p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fprabeengiri.com.np%2Fphp%2Fstroring-and-displaying-the-image-stored-as-varbinary-in-mssql-server-using-php-codeigniter.html&amp;linkname=Storing%20and%20displaying%20the%20image%20stored%20as%20varbinary%20in%20%20MSSQL%20server%20using%20PHP%20%28CodeIgniter%29"><img src="http://prabeengiri.com.np/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://prabeengiri.com.np/php/stroring-and-displaying-the-image-stored-as-varbinary-in-mssql-server-using-php-codeigniter.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple vertical accordion  menu using  JQuery</title>
		<link>http://prabeengiri.com.np/jquery/simple-vertical-accordion-menu-using-jquery.html</link>
		<comments>http://prabeengiri.com.np/jquery/simple-vertical-accordion-menu-using-jquery.html#comments</comments>
		<pubDate>Tue, 08 Jun 2010 09:49:49 +0000</pubDate>
		<dc:creator>Prabeen</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[hover event]]></category>
		<category><![CDATA[vetical accordion menu]]></category>

		<guid isPermaLink="false">http://prabeengiri.com.np/?p=570</guid>
		<description><![CDATA[Vertical jquery accordion menu , problem with mouseout and mouseover event , accordion menu ]]></description>
			<content:encoded><![CDATA[<p>I saw various tutorial  and jquery snippets to create accordion menu, but most of them were only on mousehover event  but nothing with mouse out event.A hectic problem can persist when we try to  render the accordion effect  with mouseover and mouseout event. So we need to use jquery mouse event i.e &#8216;hover&#8217; or &#8216;mouseenter&#8217; and &#8216;mouseleave&#8217;.<span id="more-570"></span></p>
<p><strong>What is the problem with  &#8216;mouseover&#8217; and &#8216;mouseout&#8217; event?<br />
</strong>Hovering over children element fires parent’s  <code>mouseout</code> event which most of the time dont require.This is caused by event bubbling / propagation.</p>
<p>So we have to use &#8216;mouseenter&#8217; and &#8216;mouseleave&#8217; , or &#8216;hover&#8217; event instead.<br />
<strong>Note: Javascript does not provide the direct &#8216;hover&#8217; event but we can get it using javascript framework  eg. &#8216;Jquery&#8217; .</strong></p>
<p><a href="http://demo.prabeengiri.com.np/accordion_menu_jquery.html" target="_blank"><strong>DEMO</strong></a></p>
<p><strong>HTML Stucture<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;accordion&quot;&gt;
  &lt;ul&gt;
    &lt;li class='selected parentCategory'&gt;
	&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; Category1 &lt;/a&gt;
        &lt;ul&gt;
             &lt;li&gt;
		 &lt;a href=&quot;http://prabeengiri.com.np&quot;&gt;subcategory1 &lt;/a&gt;
            &lt;/li&gt;
             &lt;li&gt;
		&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; subcategory2 &lt;/a&gt;
	     &lt;/li&gt;
      &lt;/ul&gt;
   &lt;/li&gt;
    &lt;li class='parentCategory'&gt;
	&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; Category2 &lt;/a&gt;
      	&lt;ul &gt;
              &lt;li&gt;
		&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; subcategory5 &lt;/a&gt;
	     &lt;/li&gt;
             &lt;li&gt;
		 &lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; subcategory1 &lt;/a&gt;
	     &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
     &lt;li class='parentCategory'&gt;
	&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; Category3 &lt;/a&gt;
      	&lt;ul &gt;
            &lt;li&gt;
		&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; subcategory5 &lt;/a&gt;
	    &lt;/li&gt;
            &lt;li&gt;
		&lt;a href=&quot;http://prabeengiri.com.np&quot;&gt; subcategory1 &lt;/a&gt;
	    &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>In the above html , &#8217;selected&#8217; class has been provided to &#8216;li&#8217; to make that particular &#8216;li&#8217; active.And also do not forget to provide the class &#8216;parentCategory&#8217; to parent &#8216;li&#8217;.<br />
<strong><br />
</strong></p>
<p><strong> </strong></p>
<p><strong>Css for accordion Menu<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style<span style="color: #00AA00;">&gt;</span>
<span style="color: #cc00cc;">#accordion</span>
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">350px</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>font-family<span style="color: #00AA00;">:</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #3333ff;">:<span style="color: #993333;">none</span> </span>outside <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul li
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#e1e1e1</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul li a
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#787878</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #933;">4px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul li li a
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul li ul
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>display<span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span>  ul li li
<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#A6A6A6</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ddd</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#accordion</span> a
<span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>text-decoration<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p><strong><br />
</strong><br />
Now its  turn of main hero;<br />
<strong>JQuery to render vertical accordion menu</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#accordion ul li.parentCategory&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">siblings</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li:not('.selected')&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
         jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li:not('.selected')&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">siblings</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li.selected'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<div id="_mcePaste" style="position: absolute; left: -10000px; top: 73px; width: 1px; height: 1px; overflow: hidden;">&lt;div id=&#8221;accordion&#8221;&gt;<br />
&lt;ul&gt;<br />
&lt;li class=&#8217;selected&#8217;&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; Category1 &lt;/a&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt;subcategory1 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; subcategory2 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; Category2 &lt;/a&gt;<br />
&lt;ul &gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; subcategory5 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; subcategory1 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; Category3 &lt;/a&gt;<br />
&lt;ul &gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; subcategory5 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;http://prabeengiri.com.np&#8221;&gt; subcategory1 &lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</div>
<p>These kind of effects seems difficult to render&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;  unless&#8230;. you get familiar with JQuery <img src='http://prabeengiri.com.np/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
<a href="http://demo.prabeengiri.com.np/accordion_menu_jquery.html" target="_blank"><strong>DEMO</strong></a></p>
<p>If you any kind of queries then please feel free to contact me. I will be pleased to help if something is related to my post. </p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fprabeengiri.com.np%2Fjquery%2Fsimple-vertical-accordion-menu-using-jquery.html&amp;linkname=Simple%20vertical%20accordion%20%20menu%20using%20%20JQuery"><img src="http://prabeengiri.com.np/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://prabeengiri.com.np/jquery/simple-vertical-accordion-menu-using-jquery.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
