Thursday, May 22, 2014

Starting with LESS in .NET environment.

Researching the topic above I did not find anything useful for my project. Therefore my team lead and I found out pretty good way to implement LESS in out Bootstrap-Knockout environment.

1. Download less-1.7.0.min.js from LESS site and add to your scripts folder.

2. Open HTML file and add the line.
<script src="Scripts/less-1.7.0.min.js"></script>

3. Using Visual studio, create .less file and add line to HTML file before js-files.
<link rel="stylesheet/less" type="text/css" href="Content/custom/css/hello1.less">

4. Open web.config file and after(underneath) <system.web> add
<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".less" mimeType="text/css" />
    </staticContent>
  </system.webServer>

Now you can play with .less files in .NET environment.

Friday, April 18, 2014

Border around inputs

Working on my project, I had problems with Chrome presentation of some elements. It creates border automatically around many elements. I had to find a cure for the problem. The answer is in such a good article. It works and removes border around elements in Chrome and Safari.

Tuesday, April 15, 2014

Disabled Tooltip

My last project runs on Bootstrap-Knockout platform.  I'm learning a lot about presenting elements in this environment. One of the major problem is to hide tooltip for Mobile views.
I searched the Internet and did not find a lot of information about such problem. One of the articles was particularly good, but I still have to find my original solution. My code disables the tooltip for Mobile users and save button functionality.
Here's what I did.

HTML:
<button class="btn btn-default btn-primary" type="button" data-bind="text: RequiresConfig == true ? 'Create' : 'Add to Cart',tooltip: { title: RequiresConfig == true ? 'Create' : 'Add to Cart', placement: 'bottom', disable: false }"></button>

Javascript/jQuery (accompanies HTML).
<script type='text/javascript'>
        jQuery(function ($) {
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                ko.bindingHandlers.tooltip = {
                    options: {
                        disable: true
                    }
                };
                ko.applyBindings({});
            }
        });
    </script>

Friday, April 11, 2014

It's not a bug!

This time QA was right. They discovered some differences in landscape and portrait views in iPhone. It's only Safari and only iPhone does this. It re-sizes the font and images going from portrait to landscape. It's not a bug, it's a iPhone feature. To fix the issue, I found an article and patched my code. Very simple line of code fixes the feature.

html {-webkit-text-size-adjust: auto;}

It was a very good learning experience for me.

Friday, March 28, 2014

How create gradient color without images...

Working on a new assignment, I had to find a way to generate gradient color.  I decided to educate myself and learn online gradient generator. First of all, I found a good one, for a second, using online tool, I generated a nice piece of code for my project.

Wednesday, February 26, 2014

Turn the arrow


Working in Bootstrap-Knockout environment, I had to find the way to implement movable arrow for mobile menu.

It's quite easy and interesting task, which I would like to document.

HTML:
 <nav>
        <div class="navbar navbar-inverse" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" id="caret-mobile">
                        <span class="sr-only">Toggle navigation</span>
                        <span id="caret-mobile" class="caret-down"></span>
                    </button>
                    <a class="navbar-brand" href="#">Menu</a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li><a href='#'>About</a></li>
                        <li><a href='#'>Contact Us</a></li>
                        <li><a href='#'>FAQ</a></li>
                        <li><a href='#'>View Cart</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
CSS:
.caret-down {
display: inline-block;
width: 0px;
height: 0px;
margin-left: 2px;
vertical-align: middle;
border-bottom: none;
border-top: 10px solid #FFFFFF;
border-right: 10px solid transparent;
border-left: 10px solid transparent;
content: "";
}

.caret-up {
display: inline-block;
width: 0px;
height: 0px;
margin-left: 2px;
vertical-align: middle;
border-top: none;
border-bottom: 10px solid #FFFFFF;
border-right: 10px solid transparent;
border-left: 10px solid transparent;
border-top-width: 0px;
border-top-style: dotted;
content: "";
}
Javascript:
<script src="jquery-2.0.3.js"></script>
<script src="bootstrap.min.js"></script>
<script type='text/javascript'>
        jQuery(document).ready(function () {
            jQuery('#caret-mobile').click(function () {
                $(".caret-down").toggleClass('caret-up');
            });
         
        });
</script>

Thursday, January 30, 2014

Web Page Ruler

On this project I work a lot with QA counting every pixel in my css-file. To finish my project I had to add new Chrome extension. It's a quite good and practical tool for Front-End Development. I hope, everybody will use this extension.

In addition I found a very good tool to compress HTML online. He it is: http://www.textfixer.com/html/compress-html-compression.php This site features more useful tools and tricks, which I will use in a future.