Friday 06 July 2012 4:03:38 pm - 1 reply
Hello Everyone;
I have some links in my website which should be displayed just for the visitors with PC.*
I have tried to do it with creating a cutom tag which contain a div or span and insert a JS code on onLoad, but it doesnt work .
Has anyone know the where the problem is come from?
I have cerated a custom Tag in my content.ini
CustomAttributes[]=display
Then in my file .tpl i have inserted a part of my javascript code:
<span id="testVisibility" onLoad="customizeForDevice();">{$content}</span>
{literal}
<script>
var customizeForDevice = function(){
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/(iPhone|iPod|iPad)/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/)
};
function visiblityTest(){
if (checker.iphone){
window.document.getElementById("testVisibility"
.style.display = "none";
}
else {
document.getElementById("testVisibility"
.style.display = "{$display}";
}
}
visiblityTest();
}
onload=customizeForDevice();
</script>
{/literal}
Modified on Friday 06 July 2012 4:51:51 pm by ray lab
You must be logged in to post messages in this topic!