Facebox hack for Internet Explorer (IE 5,6,7)
Posted by admin on March 30th, 2008
Along with jQuery, we have used third party module facebox for hindi lyrics. During testing different browsers, I got problem with placement of facebox.
In internet explorer (IE 6 & 7) it got aligned left.
So, finally I tried some cross browser hack for it. I have done some little change in facebox.js
At the end of function,
$.facebox.reveal = function(data, klass) {
I have added followng line,
if(jQuery.browser.msie){
b = $(”BODY”).width();
pl = (b - $(’#facebox .content’)[0].offsetWidth)/2;
$(’#facebox’)[0].style.paddingLeft = pl;
}
}
Explanation:-
[1] If browser is Internet Explorer, it gets width of view port into b variable
[2] Now facebox with is $(’#facebox .content’)[0].offsetWidth
[3] So, required left padding is (total screen width - box with)/2
[4] $(’#facebox’)[0].style.paddingLeft = pl line properly aligns the facebox.
Recent Comments