2016-07-26 11 views
0

私はマテリアルデザインを使用し、日付ピッカーを使用しています。日付ピッカーが飛び出すと、ページが下にスクロールします。ページをスクロールせずに日付ピッカーモーダルを読み込むにはどうすればよいですか?日付ピッカーモーダルがページ下にスクロール

<input id="client-edit-birth-date" type="text" class="datepicker validate"> 
    $('.datepicker').pickadate({ 
selectMonths: true, // Creates a dropdown to control month 
selectYears: 15, // Creates a dropdown of 15 years to control year, 
container: 'body' 
}); 

答えて

0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> 
    <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css"> 
<script type="text/javascript"> 
$(function() { 
    $('.date-picker').datepicker({ 
     changeMonth: true, 
     changeYear: true, 
     showButtonPanel: true, 
     dateFormat: 'MM yy', 
     onClose: function(dateText, inst) { 
      $(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1)); 
     } 
    }); 
}); 
</script> 
<style> 
.ui-datepicker-calendar { 
    display: none; 
    } 
</style> 
</head> 
<body> 
    <label for="startDate">Date :</label> 
    <input name="startDate" id="startDate" class="date-picker" /> 
</body> 
</html> 

demo http://jsfiddle.net/DBpJe/5106/

0

私は日付ピッカーのbeforeShow機能を利用することにより、それを実行します。

あり
$('.datepicker').datepicker({ 
    ... 
    beforeShow: function(input, inst) 
      { 
       inst.dpDiv.css({position: 'absolute'}); 
      } 
    ... 
}); 

あなたは日付ピッカーのダイアログの位置を設定することができます。どのような種類のCSSパラメータがあなたのケース/ページレイアウトに適しているかを調べるためには、実験をしなければなりません。

関連する問題