2014-04-04 85 views
2

我使用的是基於jQuery的lightbox_me腳本。當你點擊一個打開燈箱的元素時,該腳本將移除瀏覽器滾動條,並使內容向右移動,這讓我感到非常難看。它看起來越野車。如何防止Lightbox_me腳本移除瀏覽器滾動條?

我已經有安裝一個乾淨的演示可以在這裏找到:http://lyesdehili.com/LightBox.html

我怎麼能阻止它消除滾動條?

$(function() { 
function launch() { 
    $('#sign_up').lightbox_me({ 
     centered: true, 
     onLoad: function() { 
      $('#sign_up').find('input:first').focus() 
     } 
    }); 
} 

$('#try-1').click(function (e) { 
    $("#sign_up").lightbox_me({ 
     centered: true, 
     preventScroll: true, 
     onLoad: function() { 
      $("#sign_up").find("input:first").focus(); 
     } 
    }); 

    e.preventDefault(); 
}); 


$('table tr:nth-child(even)').addClass('stripe'); 
}); 


<div style="width:965px; height:1400px; background:#fff"> 
<p>Scroll down the page to find the lightbox link</p> 
</div> 

<a class="try sprited" id="try-1" href="#">Click to open lightbox</a> 

<div style="display:none; height:350px; width:400px; background:#ccc;" id="sign_up"> 
<h3 id="see_id" class="sprited" >Can I see some ID?</h3> 
<span>Please sign in using the form below</span> 
<div id="sign_up_form"> 
    <label><strong>Username:</strong> <input class="sprited"/></label> 
    <label><strong>Password:</strong> <input class="sprited"/></label> 
    <div id="actions"> 
     <a class="close form_button sprited" id="cancel" href="#">Cancel</a> 
     <a class="form_button sprited" id="log_in" href="#">Sign in</a> 
    </div> 
</div> 
<h3 id="left_out" class="sprited">Feeling left out?</h3> 
<span>Don't be sad, just <a href="#">click here</a> to sign up!</span> 
<a id="close_x" class="close sprited" href="#">close</a> 
</div> 
+0

你想身體的側欄留他們的權利?那就是當你點擊打開燈箱時,邊欄不應該隱藏......請確認一下? – Omicans

回答

1

的燈箱腳本將overflow: hidden<body>元素。

body { overflow: scroll !important; }添加到您的CSS應解決此問題。

UPDATE:

,如果你想只是將其添加到您的權利腳本,將它添加到收藏夾功能:

$("#sign_up").lightbox_me({ centered: true, preventScroll: true, onLoad: function() { $("#sign_up").find("input:first").focus(); $('body').style('overflow', 'scroll', 'important'); } });

相關問題