Wednesday, January 11, 2012

Border around div

Border around div
It's a quite popular technique. Many developers use the technique involved table structure. I think, this tip can be very useful too.

HTML-code
<div class ="newsDiv">
<h2> NEWS</h2>
<div class ="newstext">
<p>A <a href="test.asp">HTML version</a> of the SAMPLE is now available.
For smartphone users, you can use a mobile website, <a href="http://www.test.org">http://www.test.org.org</a>, to view SAMPLE.</p>
</div>
</div>

CSS-code to achieve the
.newsDiv
{
border: 1px #C0C0C0 solid;
margin-bottom: 15px;
}
.newstext
{
padding-left: 10px;
}

Thursday, January 5, 2012

jQuery Mobile and IE

Today I learned that my mobile site does not work in IE because IE does not support AJAX calls through jQuery Mobile. I went on Internet searching for answer. This time I was not lucky. Internet community did not bring any good news. It looks like many developers have the same problem. I found a code snippet which did not work at all. It should be added after jquery is loaded and before jQuery Mobile is added. Here it is :
<script type="text/javascript">

//run this script after jQuery loads, but before jQuery Mobile loads

//customize jQuery Mobile to let IE7+ in (Mobile IE)

$(document).bind("mobileinit", function(){
$.extend( $.mobile , {

//extend gradeA qualifier to include IE7+
gradeA: function(){
//IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683
var ie = (function() {
var v = 3, div = document.createElement('div'), a = div.all || [];
while (div.innerHTML = '', a[0]);
return v > 4 ? v : !v;
}());
//must either support media queries or be IE7+
return $.support.mediaquery || (ie && ie >= 7);
}
});
});
</script>
My coworkers and I agree to leave mobile version as it is. It looks like it works for most mobile devices, bit it does not work only for desktop IE. I think, jQuery Mobile really meant to be for MOBILE!