Is there a way to translate the tooltips in fancybox, e.g. the tooltip on the close button?
I have done this in the afterShow callback to change the value to Danish and seems to work.. or is there a better way to change it?
<script type="text/javascript">
$(document).ready(function() {
$("a.mapoverlay").fancybox({
width : '90%',
height : '90%',
fixed: false,
autoSize : false,
autoCenter : true,
afterLoad : function() {
loadMap();
},
afterShow : function() {
$("a.fancybox-close").attr("title", "Luk");
}
});
});
</script>
Edit: This code seems to work fine.
I got a syntax error when writing this.. I think you missed something? SyntaxError: Unexpected token }
I saw this post here: https://github.com/fancyapps/fancyBox/issues/7
<script type="text/javascript">
$(document).ready(function() {
$("a.mapoverlay").fancybox({
width : '90%',
height : '90%',
fixed: false,
autoSize : false,
autoCenter : true,
afterLoad : function() {
loadMap();
},
tpl: {
closeBtn: '<div title="Test" class="fancybox-item fancybox-close"></div>'
}
});
});
</script>
You can use the .tpl
option:
$(document).ready(function() {
$("a.mapoverlay").fancybox({
width : '90%',
height : '90%',
fixed: false,
autoSize : false,
autoCenter : true,
afterLoad : function() {
loadMap();
},
tpl: {
'<a title="Your title here!" class="fancybox-item fancybox-close" href="javascript:;"></a>'
}
});
});
EDIT : the correct format for the tpl
option is
tpl : {
closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With