- jquery hide dropdown when click anywhere but menu
- $(document).click(function(event) {
- if ($(event.target).parents().index($('.notification-container')) == -1) {
- if ($('.notification-container').is(":visible")) {
- $('.notification-container').animate({
- "margin-top": "-15px"
- }, 75, function() {
- $(this).fadeOut(75)
- });
- }
- else {
- //This should only show when you click: ".notification-button" not document
- $('.notification-container').show().animate({
- "margin-top": "0px"
- }, 75);
- }
- }
- });
- $('.drop-down').click(function () {
- // The code to open the dropdown
- $('body').click(function () {
- // The code to close the dropdown
- });
- });
- $(':not(#country)').click(function() {
- $('#countrylist').hide();
- }
- $('body').click(function(e){
- if($(e.target).closest('.notification-container').length === 0){
- // close/animate your div
- }
- });
- $(document).click(function(event) {
- if($(event.target).parents().index($('.notification-container')) == -1) {
- if($('.notification-container').is(":visible")) {
- $('.notification-container').animate({"margin-top":"-15px"}, 75, function({$(this).fadeOut(75)});
- }
- }
- });
- $(".notification-button").click(function(event){
- event.stopPropagation();
- $('.notification-container').show().animate({"margin-top":"0px"}, 75);
- });
- $(document).click(function(e) {
- var isModalBox = (e.target.className == 'modal-box');
- if (!isModalBox) {
- $('.modal-box:visible').animate({
- "margin-top": "-15px"
- }, 75, function() {
- $(this).fadeOut(75);
- });
- }
- });
- $('a').click(function(e) {
- e.stopPropagation(); // Important if you´d like other links to work as usual.
- });
- $('#temp-button').click(function(e) {
- e.preventDefault();
- $('.modal-box').show().animate({
- "margin-top": "0px"
- }, 75);
- });
- $(document).ready(function(){
- $(".notification-button").click(function(){
- $('.notification-container').toggle().animate({"margin-top":"0px"}, 75);
- });
- $('.notification-wrapper').bind('clickoutside', function (event) {
- $('.notification-container').animate({"margin-top":"-15px"}, 75, function(){$(this).fadeOut(75)});
- });
- });