Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <body>
  2. <div id="header">
  3. MY CONTENTS
  4. </div>
  5. <div id="main">
  6. MY OTHER CONTENTS
  7. </div>
  8. </body>
  9.  
  10. </div>
  11.  
  12. html,body {
  13. height:100%;
  14. }
  15. #header {
  16. position:absolute;
  17. width: 100%;
  18. height: 100px;
  19. background:#c3c3c3;
  20. z-index:1;
  21. }
  22. #main {
  23. background: #eee;
  24. height:100%;
  25. border-top:100px solid transparent;
  26. -webkit-box-sizing:border-box;
  27. -moz-box-sizing:border-box;
  28. box-sizing:border-box;
  29. overflow:auto;
  30. }​
  31.  
  32. #div2 {
  33. overflow-y: scroll;
  34. }
  35.  
  36. body{
  37. overflow: hidden;
  38. }
  39. #main{
  40. overflow: scroll;
  41. }
  42. #maincontent{
  43. height: 1500px;
  44. }
  45.  
  46. <script>
  47. $("#cart").bind("mousewheel", function(e){
  48. var intElemScrollHeight = document.getElementById("cart").scrollHeight;
  49. var intElemClientHeight = document.getElementById("cart").clientHeight;
  50. if( intElemScrollHeight - $("#cart").scrollTop() === intElemClientHeight) {
  51. $(document).bind("mousewheel", function(event) {
  52. event.preventDefault();
  53. });
  54. }
  55. if(e.originalEvent.wheelDelta /120 > 0 ) {
  56. if($("#cart").scrollTop() != 0) {
  57. $(document).unbind("mousewheel");
  58. } else {
  59. event.preventDefault();
  60. }
  61. }});
  62. $("#cart").on("mouseleave", function(event) {
  63. $(document).unbind("mousewheel");
  64. });
  65. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement