Dienstag, 27. September 2011

Dienstag, 30. August 2011

Styling Browser Validation Messages

With HTML5 there came the great power of using the browsers built-in validation methods for <input> fields. Some days ago I heared a co-worker arguing that it's not possible to style the error messages generated by the browser. It's just wrong. You can style them, they are using pseudo classes and, of course, every browser uses different pseudo classes:

Firefox: https://developer.mozilla.org/en/CSS/%3ainvalid
Chrome [Webkit]: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css (search for 'bubble' there)

Sadly, if you want to use it today, you have to implement a fallback for IE.



Donnerstag, 25. August 2011

Coding Backwards

Now this is a really cool idea how to get a gerneral idea of the design you really need (and this is NOT the design that comes to your mind FIRST):

"I decided that I’d [...] write out a script using the yet unwritten API. I’d reverse-engineer a good design by pretending I’d already written one!"

"A better design quickly appeared when I forced myself to preemptively eat my own dogfood. Instead of shoehorning use-cases into a class structure I’d already designed, I coded backwards and the opposite happened: a design evolved from daydreaming about an API that I’d like using."

SOURCE: http://jameso.be/2011/08/19/coding-backwards.html



Montag, 25. Juli 2011

For all your opacity needs

in this order:

opacity: .5; // for all other browsers
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; // for IE8
filter: alpha(opacity=50); // for IE5-7

Samstag, 23. Juli 2011

JS Module Pattern

var someModule = (function(){
//private attributes
  var privateVar = 5;

  //private methods
  var privateMethod = function(){
  return 'Private Test';
  };

  return {
    //public attributes
    publicVar: 10,
    //public methods
    publicMethod: function(){
      return ' Followed By Public Test ';
    },

    //let's access the private members
    getData: function(){
      return privateMethod() + this.publicMethod() + privateVar;
    }
  }
})(); //the parens here cause the anonymous function to execute and return
        
someModule.getData();
SOURCE: http://addyosmani.com/resources/essentialjsdesignpatterns/book/

Dienstag, 19. Juli 2011

Nyromodal Wiki Startpage is defective, use this older version instead

http://bit.ly/qUra4h

Nyromodal strips / removes script tag on ajax / xhr load

Got me some time to get 'round this, here's the solution:

"If you need to use an external JavaScript content, you could add the attribute rel="forceLoad" to the script tag and nyroModal will load it during the opening modal."


"If you want to use a script which need the content to be visible (many jQuery UI script for instance) you could add the setting rev="shown" to the inline or external script tag to execute it juste before the endShowContent callback."

Source: http://bit.ly/oJ8AeD