torstai 28. tammikuuta 2016

CSS Tricks - Text overflow fixed with Css

So probably everyone has seen a problem where floating items or text overflows the current div. The usual solution is to create empty div after the element and clear both, but it can be solved with pure CSS. Here is how:

.classname::after{
  content:"";
  clear:both;
  display: block;
}

Use pseudo element after to add an empty item. This fixes the overflowing problem without using: overflow: hidden.

keskiviikko 27. tammikuuta 2016

jQuery tricks Toggle HTML Element Change

I struggled so much about changing element with jQuery and I finally after few hours of searching found a little hack to do this so I wanted to share it with everyone.

First create two html elements with same classname, but add display:none to other element like this:

  <span class="trick">Open</span>
  <span class="trick" style="display:none;">Closed</span>

Then with jQuery just do

  $('.trick').toggle();

And super, the element is toggling!

torstai 14. tammikuuta 2016

Storing cordova project to Git

I have had this question in my mind for a while. What should I store to git when creating Cordova project? Here is the answer:

hooks (can be empty)
res
www (not mandatory)
config.xml
splash.png

So the minimum requirements are there. Even www folder is not mandatory if project is generated from other files. After you have cloned the project, create folders: plugins, www, platforms and use command: cordova platform add android

With empty folders cordova recognizes the project. So platform folder should always be generated on development computer.