# Mobile dropdown is opening en closing down instantly

**URL:** <https://community.hubspot.com/t/mobile-dropdown-is-opening-en-closing-down-instantly/70262>\
**Category:** CMS Development\
**Tags:** design-manager, javascript, html\
**Created:** [November 30, 2022, 2:18pm UTC](https://community.hubspot.com/t/mobile-dropdown-is-opening-en-closing-down-instantly/70262 "2022-11-30T14:18:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTang4](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@CTang4](https://community.hubspot.com/u/CTang4)\
**Post date:** [November 30, 2022, 2:18pm UTC](https://community.hubspot.com/t/mobile-dropdown-is-opening-en-closing-down-instantly/70262/1 "2022-11-30T14:18:50Z")

</div>

The dropdown is instantly opening and closing down when It’s a toggle. I don’t why but It’s asking for the value twice when I looked at it in the console log. I want it to only open once and close when I click on it again.  
**Link: ( [https://www.helionova.co.uk/test-blog](https://www.helionova.co.uk/test-blog) )  
HTML:**

\<div class=“container\_box”\>  
\<div class=“container\_purple”\>  
\<div class=“container\_header”\>  
\<div class= “blog\_header” \>  
\<h1\>  
{{ module.blog\_listing\_header }}  
\</h1\>  
\<p\>  
{{ module.blog\_header\_text }}  
\</p\>  
\</div\>  
\</div\>  
\</div\>  
\<div class=“filter”\>  
\<li\>\<a class=“btn” href=“[https://www.helionova.co.uk/test-blog](https://www.helionova.co.uk/test-blog)”\>All\</a\> \</li\>  
\<li\>\<a class=“btn” href=“[https://www.helionova.co.uk/test-blog/tag/sunbeds](https://www.helionova.co.uk/test-blog/tag/sunbeds)”\>Sunbeds\</a\>\</li\>  
\<li\>\<a class=“btn” href=“[https://www.helionova.co.uk/test-blog/tag/rental](https://www.helionova.co.uk/test-blog/tag/rental)”\>Rental\</a\>\</li\>  
\<li\>\<a class=“btn” href=“[https://www.helionova.co.uk/test-blog/tag/lamps](https://www.helionova.co.uk/test-blog/tag/lamps)”\>Lamps\</a\>\</li\>  
\</div\>  
\<div class=“mobile\_btn”\>  
\<span class=“dropbutton”\>Show all  
\<div class= “svg\_move”\>  
\<svg width=“9” height=“6” fill=“none” xmlns=“[SVG namespace](http://www.w3.org/2000/svg)”\>\<path fill-rule=“evenodd” clip-rule=“evenodd” d=“M3.995 5.053.138 1.12A.485.485 0 0 1 0 .777C0 .647.05.526.138.435l.284-.29a.468.468 0 0 1 .67 0l3.24 3.304L7.574.14a.466.466 0 0 1 .67 0l.284.29c.09.091.139.213.139.342 0 .13-.05.251-.139.342l-3.86 3.938a.467.467 0 0 1-.336.141.466.466 0 0 1-.337-.14Z” fill=“#1A1A1A”\>\</path\>\</svg\>  
\</div\>  
\</span\>  
\<div id=“dropdown\_\_list-show” class=“dropdown\_content”\>  
\<a href=“[https://www.helionova.co.uk/test-blog](https://www.helionova.co.uk/test-blog)”\>All\</a\>  
\<a href=“[https://www.helionova.co.uk/test-blog/tag/sunbeds](https://www.helionova.co.uk/test-blog/tag/sunbeds)”\>Sunbeds\</a\>  
\<a href=“[https://www.helionova.co.uk/test-blog/tag/rental](https://www.helionova.co.uk/test-blog/tag/rental)”\>Rental\</a\>  
\<a href=“[https://www.helionova.co.uk/test-blog/tag/lamps](https://www.helionova.co.uk/test-blog/tag/lamps)”\>Lamps\</a\>  
\</div\>  
\</div\>  
\<div class=“content-wrapper”\>  
\<div class=“blog-index”\>  
{% for content in contents %}  
\<div class=“blog-index\_\_postblog-index\_\_post–small”\>  
{% if not simple\_list\_page %}  
\<div class=“blog-index\_\_post-inner-card{% if not content.featured\_image %} no-image{% endif %}”\>  
{% if content.featured\_image %}  
\<a class=“blog-index\_\_post-image” style=“background-image: url(‘{{ content.featured\_image }}’)” href=“{{ content.absolute\_url }}”\>  
\</a\>  
{% endif %}  
\<div class=“blog-index\_\_post-content blog-index\_\_post-content–small”\>  
{% if content.tag\_list %}  
\<div class=“blog-post\_\_tags”\>  
{% for tag in content.tag\_list %}  
\<a class=“blog-post\_\_tag-link” href=“{{ blog\_tag\_url(group.id, tag.slug) }}”\>{{ tag.name }}\</a\>{% if not loop.last %},{% endif %}  
{% endfor %}  
\</div\>  
{% endif %}  
\<div class = “content\_title”\>  
\<p\>  
\<a href=“{{ content.absolute\_url }}”\>{{ content.name }}\</a\>  
\</p\>  
\</div\>  
\<div class=“content\_text”\>  
{{ content.post\_list\_content|truncatehtml(100)|striptags|safe }}  
\</div\>  
\</div\>  
\<div class=“author\_readtime”\>  
\<img alt=“{{ content.blog\_post\_author.display\_name }}” src=“{{ content.blog\_post\_author.avatar }}” class=“author\_icon”\>  
\<span class=“author\_name”\> By \<strong\>{{ content.blog\_post\_author.display\_name }}\</strong\>\</span\>  
\<span\>\ \• \ \</span\>  
\<span class=“readtime”\>  
{{ content.post\_body|split(’ ',5000)|length|divide(250)|round(0,‘ceil’) }} minute read  
\</span\>  
\</div\>  
\</div\>  
{% else %}  
\<h2 class=“post-listing-simple”\>\<a href=“{{content.absolute\_url}}”\>{{ content.name }}\</a\>\</h2\>  
{% endif %}  
\</div\>  
{% endfor %}  
\</div\>

{% if contents.total\_page\_count \> 0 %}  
\<div class=“blog-pagination”\>  
{% set page\_list = [-2, -1, 0, 1, 2] %}  
{% if contents.total\_page\_count - current\_page\_num == 1 %}{% set offset = -1 %}  
{% elif contents.total\_page\_count - current\_page\_num == 0 %}{% set offset = -2 %}  
{% elif current\_page\_num == 2 %}{% set offset = 1 %}  
{% elif current\_page\_num == 1 %}{% set offset = 2 %}  
{% else %}{% set offset = 0 %}{% endif %}  
{% if current\_page\_num == 1 %}{{ blog-pagination\_\_prev-link--disabled }} {% endif %}  
\<a class=“blog-pagination\_\_link blog-pagination\_\_prev-link {{ “blog-pagination\_\_prev-link--disabled” if !last\_page\_num }}”{% if !last\_page\_num %} {% else %} href=“{{ blog\_page\_link(last\_page\_num) }}” {% endif %}\>  
{% icon name=“chevron-left” style=“SOLID”, width=“13”, no\_wrapper=True %}  
\</a\>  
{% for page in page\_list %}  
{% set this\_page = current\_page\_num + page + offset %}  
{% if this\_page \> 0 and this\_page \<= contents.total\_page\_count %}  
\<a class=“blog-pagination\_\_link blog-pagination\_\_number-link {{ “blog-pagination\_\_link--active” if this\_page == current\_page\_num }}” href=“{{ blog\_page\_link(this\_page) }}”\>{{ this\_page }}\</a\>  
{% endif %}  
{% endfor %}  
\<a class=“blog-pagination\_\_link blog-pagination\_\_next-link {{ “blog-pagination\_\_next-link--disabled” if !next\_page\_num }}” {% if !next\_page\_num %} {% else %} href=“{{ blog\_page\_link(current\_page\_num + 1) }}” {% endif %}\>

{% icon name=“chevron-right” style=“SOLID”, width=“13”, no\_wrapper=True %}  
\</a\>  
\</div\>  
{% endif %}  
\</div\>  
\</div\>

**Javascript&colon;**

$(function(){  
var numEx = window.location.pathname.split(‘/’);  
var pN = numEx[numEx.length - 1]  
if (window.location.href.indexOf(“test-blog”) \> -1){  
var current = location.pathname.replace(‘/page/’ + pN, ‘’ );  
console.log(current)  
$(‘.filter .btn’).each(function(){  
var $this = $(this);  
if (current == ‘/test-blog’ && $this.attr(‘href’) == ‘[https://www.helionova.co.uk/test-blog](https://www.helionova.co.uk/test-blog)’){  
$this.addClass(‘active’);  
} else if ($this.attr(‘href’).indexOf(current) !== -1 && current !== ‘/test-blog’){  
$this.addClass(‘active’)  
}  
})  
}  
})

**Mobile view dropdown function:**  
$(function(){  
$(‘.dropbutton’).click(function(){  
$(this).parent().find(‘#dropdown\_\_list-show’).slideToggle();  
})  
});

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [December 2, 2022, 7:49pm UTC](https://community.hubspot.com/t/mobile-dropdown-is-opening-en-closing-down-instantly/70262/2 "2022-12-02T19:49:44Z")

</div>

Hi, @CTang4 👋 Thanks for reaching out. Hey, @assi @miljkovicmisa @alyssamwilie, any thoughts or troubleshooting tips for @CTang4? Thank you for taking a look! — Jaycee

---

<div class="post-metadata">

**Author:** ![CTang4](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@CTang4](https://community.hubspot.com/u/CTang4)\
**Post date:** [January 3, 2023, 7:55am UTC](https://community.hubspot.com/t/mobile-dropdown-is-opening-en-closing-down-instantly/70262/3 "2023-01-03T07:55:52Z")

</div>

Can you still help me with this issue? I can’t solve this issue.
