{"id":143,"date":"2020-06-03T07:22:28","date_gmt":"2020-06-03T04:22:28","guid":{"rendered":"http:\/\/bahadirmeric.net\/bahadir\/?p=143"},"modified":"2020-06-03T07:22:28","modified_gmt":"2020-06-03T04:22:28","slug":"jquery-accordion-menu-kapali-gelsin","status":"publish","type":"post","link":"http:\/\/bahadirmeric.net\/bahadir\/2020\/06\/03\/jquery-accordion-menu-kapali-gelsin\/","title":{"rendered":"JQuery Accordion Men\u00fc Kapal\u0131 Gelsin"},"content":{"rendered":"\n<p>JQuery ile accordion men\u00fc yapanlar \u00fc\u00e7 a\u015fa\u011f\u0131 be\u015f yukar\u0131 bilirler. Men\u00fcy\u00fc yapt\u0131ktan sonra otomatik olarak ilk se\u00e7enek yada ilk akordion men\u00fcn\u00fcz otomatik olarak a\u00e7\u0131k gelir. Fakat bazen bu durumun olu\u015fmas\u0131n\u0131 istemeyebiliriz. Yani men\u00fcn\u00fcn kapal\u0131 gelmesini isteyebiliriz. \u0130\u015fte o zaman ne edece\u011fiz? Cevab\u0131 a\u015fa\u011f\u0131da;<\/p>\n\n\n\n<p>\u015eimdi k\u00fc\u00e7\u00fck bir kod ile duruma bakal\u0131m. Bu arada bunu \u00f6nlemenin iki yolu oldu\u011funu da yazal\u0131m \u00f6nce ben sizle CSS ile bu durumu nas\u0131l \u00f6nleyebilece\u011finizi g\u00f6sterece\u011fim.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Accordion Men\u00fc Yap\u0131m\u0131&lt;\/title&gt;\n&lt;script type=&quot;text\/javascript&quot; src=&quot;http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.6.2\/jquery.min.js&quot;&gt;&lt;\/script&gt;\n&lt;script type=&quot;text\/javascript&quot; src=&quot;accordion.js&quot;&gt;&lt;\/script&gt;\n&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; \/&gt;\n&lt;script type=&quot;text\/javascript&quot;&gt;\nddaccordion.init({\n    headerclass: &quot;expandable&quot;,\n    contentclass: &quot;categoryitems&quot;,\n    revealtype: &quot;click&quot;,\n    mouseoverdelay: 200,\n    collapseprev: true, \n    defaultexpanded: &#x5B;0],\n    onemustopen: false,\n    animatedefault: false, \n    persiststate: true,\n    toggleclass: &#x5B;&quot;&quot;, &quot;openheader&quot;], \n    togglehtml: &#x5B;&quot;prefix&quot;, &quot;&quot;, &quot;&quot;],\n    animatespeed: &quot;fast&quot;, \n    oninit:function(headers, expandedindices){},\n    onopenclose:function(header, index, state, isuseractivated){}\n});\n&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div class=&quot;arrowlistmenu&quot;&gt;\n    &lt;h3 class=&quot;menuheader expandable&quot;&gt;Web Sitleri&lt;\/h3&gt;\n    &lt;ul class=&quot;categoryitems&quot;&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/www.bcakir.com&quot;&gt;bcakir&lt;\/a&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/www.egitimmateryalleri.com&quot;&gt;egitimmateryalleri&lt;\/a&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;\n     \n    &lt;h3 class=&quot;menuheader expandable&quot;&gt;Facebook Yaz\u0131lar\u0131&lt;\/h3&gt;\n    &lt;ul class=&quot;categoryitems&quot;&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/bcakir.com\/?p=835&quot;&gt;Facebook Tarz\u0131 Resim Galerisi&lt;\/a&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/bcakir.com\/?p=858&quot;&gt;Video Oyunlar\u0131 Kan Kaybediyor&lt;\/a&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/bcakir.com\/?p=833&quot;&gt;Sosyal Oyun Pazar\u0131 B\u00fcy\u00fckl\u00fc\u011f\u00fc&lt;\/a&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;\n     \n    &lt;h3 class=&quot;menuheader expandable&quot;&gt;Css Yaz\u0131lar\u0131&lt;\/h3&gt;\n    &lt;ul class=&quot;categoryitems&quot;&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/bcakir.com\/?p=650&quot;&gt;Sabit Reklam Alan\u0131 Yapma&lt;\/a&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;a href=&quot;http:\/\/bcakir.com\/?p=653&quot;&gt;Css ile Taray\u0131c\u0131 S\u0131f\u0131rlama&lt;\/a&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;\n&lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre><\/div>\n\n\n<p>\u015eimdi bu kod \u00f6rne\u011finde \u201c<strong>defaultexpanded: [0]<\/strong>\u201d ile bir tan\u0131mlama yap\u0131lm\u0131\u015f. Bunu kald\u0131rman\u0131z ilk y\u00fckleni\u015fde akordiyon men\u00fcn\u00fcz\u00fcn ilk \u00f6\u011fesinin a\u00e7\u0131k de\u011fil kapal\u0131 gelmesini sa\u011flayacakt\u0131r. Birde \u015f\u00f6yle bir \u00f6rne\u011fimiz var;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;!doctype html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n&lt;head&gt;\n  &lt;meta charset=&quot;utf-8&quot;&gt;\n  &lt;title&gt;jQuery UI Accordion - Default functionality&lt;\/title&gt;\n  &lt;link rel=&quot;stylesheet&quot; href=&quot;\/\/code.jquery.com\/ui\/1.11.2\/themes\/smoothness\/jquery-ui.css&quot;&gt;\n  &lt;script src=&quot;\/\/code.jquery.com\/jquery-1.10.2.js&quot;&gt;&lt;\/script&gt;\n  &lt;script src=&quot;\/\/code.jquery.com\/ui\/1.11.2\/jquery-ui.js&quot;&gt;&lt;\/script&gt;\n  &lt;link rel=&quot;stylesheet&quot; href=&quot;\/resources\/demos\/style.css&quot;&gt;\n  &lt;script&gt;\n  $(function() {\n    $( &quot;#accordion&quot; ).accordion();\n  });\n  &lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  \n&lt;div id=&quot;accordion&quot;&gt;\n  &lt;h3&gt;Section 1&lt;\/h3&gt;\n  &lt;div&gt;\n    &lt;p&gt;\n    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer\n    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit\n    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut\n    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.\n    &lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;h3&gt;Section 2&lt;\/h3&gt;\n  &lt;div&gt;\n    &lt;p&gt;\n    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet\n    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor\n    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In\n    suscipit faucibus urna.\n    &lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;h3&gt;Section 3&lt;\/h3&gt;\n  &lt;div&gt;\n    &lt;p&gt;\n    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.\n    Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero\n    ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis\n    lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.\n    &lt;\/p&gt;\n    &lt;ul&gt;\n      &lt;li&gt;List item one&lt;\/li&gt;\n      &lt;li&gt;List item two&lt;\/li&gt;\n      &lt;li&gt;List item three&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/div&gt;\n  &lt;h3&gt;Section 4&lt;\/h3&gt;\n  &lt;div&gt;\n    &lt;p&gt;\n    Cras dictum. Pellentesque habitant morbi tristique senectus et netus\n    et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in\n    faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia\n    mauris vel est.\n    &lt;\/p&gt;\n    &lt;p&gt;\n    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.\n    Class aptent taciti sociosqu ad litora torquent per conubia nostra, per\n    inceptos himenaeos.\n    &lt;\/p&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre><\/div>\n\n\n<p>Bu kod \u00f6rne\u011finde de \u201c<strong>$( \u201c#accordion\u201d ).accordion();<\/strong>\u201d olarak yaz\u0131lm\u0131\u015f olan k\u0131sm\u0131 \u015fu \u015fekilde de\u011fi\u015ftirmeniz yetecektir. \u201c<strong>$( \u201c#accordion\u201d ).accordion({ active: false, collapsible: true });<\/strong>\u201d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JQuery ile accordion men\u00fc yapanlar \u00fc\u00e7 a\u015fa\u011f\u0131 be\u015f yukar\u0131 bilirler. Men\u00fcy\u00fc yapt\u0131ktan sonra otomatik olarak ilk se\u00e7enek yada ilk akordion men\u00fcn\u00fcz otomatik olarak a\u00e7\u0131k gelir. Fakat bazen bu durumun olu\u015fmas\u0131n\u0131 istemeyebiliriz. Yani men\u00fcn\u00fcn kapal\u0131 gelmesini isteyebiliriz. \u0130\u015fte o zaman ne edece\u011fiz? Cevab\u0131 a\u015fa\u011f\u0131da; \u015eimdi k\u00fc\u00e7\u00fck bir kod ile duruma bakal\u0131m&#8230;. <a class=\"continue-reading-link\" href=\"http:\/\/bahadirmeric.net\/bahadir\/2020\/06\/03\/jquery-accordion-menu-kapali-gelsin\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":13,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[7,4,15,6],"class_list":["post-143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","tag-asp-net","tag-c","tag-jquery","tag-visual-studio"],"_links":{"self":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/comments?post=143"}],"version-history":[{"count":1,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":144,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/posts\/143\/revisions\/144"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/media\/13"}],"wp:attachment":[{"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/media?parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/categories?post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bahadirmeric.net\/bahadir\/wp-json\/wp\/v2\/tags?post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}