我正在模态窗口(fancybox)中呈现共享facebook按钮。
它在Chrome和Firefox上运行良好,但我无法让它在IE 11中运行。
代码看起来完全相同。
这就是我所拥有的:
<body>
<div id="fb-root"></div>
<script>
var cultureInfo = '@System.Globalization.CultureInfo.CurrentCulture.Name';
cultureInfo = (cultureInfo == "fr" ? "fr_FR" : "en_US");
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/" + cultureInfo + "/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
...
<a class="fancybox" rel="group" href="@(item.video == null ? "/Content/Image/Facteur/" + item.photo : item.video)" style="text-decoration: none;">
</a>
<div style="display: none;">
<!-- my title for fancybox above-->
<div class="fb-share-button coeurJumbotron" data-href="@Ressources.webAdress/facteur/FacteurStatic?Id=@item.Id" data-type="button_count" style="width:auto;"></div>
<p class="lead"><h4 style="color:black;"><u><b>@item.prenom @item.nom</b></u></h4><h5 style="color:black;"><b> @item.ville.nom, @item.ProvinceCulture</b></h5><h5 style="color:black;">@Ressources.wordBornIn @item.dob.Year</h5></p>
<p class="lead"><h4 style="color:black;"><b>«</b> @Html.Raw(item.commentaire.ToString().Replace("\n", "<br />")) <b>»</b></h4></p>
</div>
...
<script>
$(document).ready(function () {
$(".fancybox").fancybox({
beforeShow: function () {
// set variable to next div element
newTitle = $(this.element).next('div')
// clone it with properties
.clone(true, true)
// change ID to avoid ID duplication
.find("#demo").attr("id", "demo2").end()
// change the target to new ID
.find("#btnTranslate").attr("data-target", "#demo2").end()
// show as html
.html();
// override fancybox title
this.title = '<div class="myTitle">' + newTitle + '</div>';
}
});
});
</script>
有任何线索吗?谢谢!