javascript - Jquery show div content onload and hide of the first click -


i have created side menu bar menu items has id's 'h1-1', 'h1-2','h1-3' , on. when first load page need show 'h1-1' content. i've written code

 $(document).ready(function() {            window.onload = $('#h1-1').show();     }); 

but here, when click other menu item first, 'h1-1' content still show on page , clicked list item content showing below 'h1-1' content .

however when 'h1-1' first , click other list items, works fine (when 'h1-1' first, 'h1-1' content still showing , click other list item 'h1-1' content go away , show clicked item content).

i've tried write hide 'h1-1' content on first click then, 'h1-1' content not showing when click 'h1-1' list item itself.

can suggest way how can solve this..

fiddle demo

you relying on content of curpage hide previous page, initialize "". instead, set first page.

var curpage="h1-1"; 

updated fiddle


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -