Skip to content

Instantly share code, notes, and snippets.

@bulbul84
Last active November 23, 2016 21:33
Show Gist options
  • Save bulbul84/2601b27488d13604883ee91a7132f20f to your computer and use it in GitHub Desktop.
Save bulbul84/2601b27488d13604883ee91a7132f20f to your computer and use it in GitHub Desktop.
Support bootstrap dropdown item on touchscreen
<!-- This is one of them -->
<li class="popup_login_form has_dropdown dropdown">
<button class="dropdown-toggle" type="button" data-toggle="dropdown">
<img width="12" style="margin-top: -6px" src="images/profile.png" alt="">
<span class="angle_down"><img src="images/arrow_down_gray.svg" alt=""></span>
</button>
<ul class="dropdown-menu">
<form action="after-login-home.html">
<div class="from-group">
<input type="email" placeholder="bulbulhasan" required>
</div>
<div class="from-group">
<input type="password" placeholder="Password" required>
</div>
<div class="from-group remember-me">
<label>
<input type="checkbox" name="remember" style="height: 15px;">
<span>Remember me</span>
</label>
</div>
<div class="from-group login_submit_button">
<input class="btn btn-primary" type="submit" value="Login">
</div>
<div class="from-group forget-password">
<a href="#" class="recover-password">Forgot password? <span>Recover here</span></a>
</div>
</form>
</ul>
</li>
<!-- This is another one -->
<li class="has_dropdown dropdown logged_user">
<button class="dropdown-toggle" type="button" data-toggle="dropdown"><span class="welcome">Welcome Back</span>Md Bulbul Hasan
<span class="angle_down"><img src="images/arrow_down_gray.svg" alt=""></span></button>
<ul class="dropdown-menu user_menu">
<li><a href="account-info.html"><img width="9" src="images/profile.png" alt=""> Profile</a></li>
<li><a href="#"><img width="12" src="images/setting.png" alt=""> Setting</a></li>
<li><a href="index.html"><img width="12" src="images/logout.png" alt=""> Logout</a></li>
</ul>
</li>
/* Use below code on you main .js file */
/* Bootstrap Dropdown menu display on andriod+ios */
$('.dropdown-menu input, .dropdown-menu label').click(function(e) {
e.stopPropagation();
});
/* Bootstrap Dropdown menu display on andriod+ios */
$('.dropdown-toggle').click(function(e) {
e.preventDefault();
setTimeout($.proxy(function() {
if ('ontouchstart' in document.documentElement) {
$(this).siblings('.dropdown-backdrop').off().remove();
}
}, this), 0);
});
/* IF Not work above code then use below code for Bootstrap Dropdown menu display on andriod+ios */
$('.dropdown a').click(function(e) {
e.preventDefault();
setTimeout($.proxy(function() {
if ('ontouchstart' in document.documentElement) {
$(this).siblings('.dropdown-backdrop').off().remove();
}
}, this), 0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment