実際、問題はコードの残りの部分にあります。私にそれを掘り起こさせてくれて残念です。:P
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
// etc etc.
したがって、preventDefault により、href が起動するのを防ぎます。ここでチェックインにパッチを当ててみませんか:
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
if ($(window).width() < 767)
{
// I'm assuming you'd get this dynamically somehow;
location.href="https://secured.sirvoy.com/book.php?c_id=1602&h=ea3a7c9286f068fb6c1462fad233a5e0";
return;
}
// etc etc.
追加 | OPがプロジェクトを機能させるのに役立つ機能の全文:
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
if ($(window).width() < 767)
{
// I'm assuming you'd get this dynamically somehow;
location.href="https://secured.sirvoy.com/book.php?c_id=1602&h=ea3a7c9286f068fb6c1462fad233a5e0";
return;
}
//Get the A tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set height and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//transition effect
$(id).fadeIn(2000);
});