Close Bootstrap Dropdown Programmatically

The HTML

dropdown_boarder_fix_01

<div class="ml-menu dropdown pull-right" style="margin-top: -10px; display:none;">
    <a href="#" role="menu" data-toggle="dropdown">
        <i class="fa fa-bars fa-fw"></i>
    </a>

    <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dLabel">
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">
                <i role="menuitem" class="fa fa-trash-o"
                    data-bind="click: $parent.deleteMeasureApi">
                </i>
            </a>
        </li>
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">
                <i role="menuitem" class="fa fa-edit"
                    data-bind="click: $parent.editMeasureApi"></i>
            </a>
        </li>
    </ul>
</div

$('.ml-menu').removeClass('open');

This is what happens when the ‘open’ class is removed to close the drop-down – you can see the border around the icon

dropdown_boarder_fix_02

The solution

.find('.ml-menu').removeClass('open')
.find('a').blur();

The border is left because bootstrap sets anchor colour when it’s in focus. This happens during the click event. But because we are closing the menue programatically by removeing .open, the focus is still on. So, we remove it and the border will not show

Posted in Client Side

Can’t Add Comments on Youtube

This post is just an illustration to the solution offered by  Erik Pontius on Google Product Forum. It worked well for me so, I am adding it for the benefit of other frustrated Chrome users as well as myself as a reference. Read more ›

Posted in SysAdmin

Windows 8 Borders Size

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics

Change:

BorderWidth

PaddedBorderWidth
Tagged with:
Posted in SysAdmin

Adjust Aspose Shape Size To Text

I was working on fixing a bug. The problem was that when a section of a web application was exported to a Power Point using Aspose API, a large text in a slide title would overflow down covering the slide content. I thought that it would be cool to dynamically adjust the slide title font size to keep its content within the designated text frame. So, here’s a small piece of code that did it… Read more ›

Posted in Uncategorized

MVC Ajax Error Handling using FilterAttribute

I am using FilterAttribute and IExceptionFilter as parent classes because, for some reason, when using HandleErrorAttribute instead, the filter is hit twice when an error is thrown is a controller action method called using Ajax Read more ›

Tagged with:
Posted in Asp.Net MVC

Binding a Model To a DropDownListFor in MVC Razor View

Working with a DropDownList in Razor, here’s how a model can be bound to a DropDownListFor Read more ›

Tagged with:
Posted in Asp.Net MVC

JavaScript and CSS Reference in MVC Razor Views

I learnt this tip when going through a PluralSight course Introduction to ASP.NET MVC 3 by Scott Allen. Great course content and very easy to follow. Here’s a more elegant way of referencing JavaScript and CSS files in your views Read more ›

Tagged with:
Posted in Asp.Net MVC

Error 2 The type ‘System.Web.Mvc. ModelClientValidationRule’ exists in both …

I was writing an extension method for HtmlHelper class and needed a reference to  TagBuilder. The TagBuilder class is in System.Web.WebPages assembly so, I added it. On compile I received the following error message: Read more ›

Tagged with:
Posted in Visual Studio

Chrome 25 Slow Over RDP

After installing Chrome 25 on my laptop (Win 7 x64) that I access over RDP, I noticed a significant browser performance degradation. Just clicking on the “Customise and control Google Chrome” would respond in about a few seconds.

Googled and found a couple of options that totally solved the problem. Read more ›

Posted in SysAdmin

Windows 7 Explorer Refresh Bug

Yes, I got “bitten” by this bug too ;)

If you google for “Windows 7 Explorer Refresh Bug”, you’ll get the picture. The problem seems to be very wide-spread. I, too, read many posts and tried different suggested solutions. In my case they just did not help.

The way I solved this issue on my PC (Windows 7 x64 Professional) was Read more ›

Tagged with:
Posted in SysAdmin

Categories

Archives

highslide for wordpress