0

I am trying to make it so when i click outside the box the box scrolls up but i cant manage to get that done.

http://jsfiddle.net/t9hq9/19/

   <style type='text/css'>
    #content {
    width: 400px;
    border-left: 10px solid #FA802F;
    border-right: 10px solid #FA802F;
    text-align: center;
    padding: 100px 0px 100px 0px;
    display: none;
}

#bottom{
    width: 420px;
    height: 100px;

    background-color: #FA802F;
    -webkit-border-bottom-left-radius: 50px;
    -moz-border-bottom-left-radius: 50px;
    border-bottom-left-radius: 100px;

    -webkit-border-bottom-right-radius: 50px;
    -moz-border-bottom-right-radius: 50px;
    border-bottom-right-radius: 100px;   
    }
  </style>



<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
$('#bottom').toggle(

function() {
    $('#content').slideDown();
}, function() {
    $('#content').slideUp();
});
});//]]>  

</script>


</head>
<body>
  <div id="content">CONTENT</div>
<div id="bottom"></div>

</body>
soniccool
  • 5,790
  • 22
  • 60
  • 98

3 Answers3

0

I use:

$(document).click(function(e) {
  if (/*test for mouse over the box*/) {
    $('#content').slideDown();
  }
}
0
$('#bottom').click(function() {
    $('#content').slideDown();
});

$(document).click(function(e) {
    if (e.target.id !='bottom') {
        $('#content').slideUp();
    }
});

Fiddle: http://jsfiddle.net/t9hq9/24/

adeneo
  • 312,895
  • 29
  • 395
  • 388
0

try this working code on js fiddle

also look this post for more reference post

Community
  • 1
  • 1
Kamran Ali
  • 5,904
  • 2
  • 26
  • 36