jquery - unable to place javascript into if else statement -


so have nifty little if else statement prepared i.e9 being zombie browser doesn't support things css3 animations (generally) if statement ....

if ((old_ie > -1) || (new_ie > -1)) {     ms_ie = true; } if (ms_ie) {  } else {  } $('.submenu-ctn').fadeto(3000, 1); 

i trying fit script if else statement...

$(document).ready(function() {     $("body").on("click", ".slide", function(e) {         e.preventdefault();         $("#mission,#overview,#music,#potential,#people,#expression,#ethos,#cpd,#workshop,#team,#referrals,#local-links,#family,#mental,#palliative,#autism,#schools,#dementia,#private,#acreditations,#definitions,#research,#contact,#email,#phone,#contact-form,#finley,#councelling,#music-performance,#community-music,.slides").addclass("bounceoutup");         var = this;         settimeout(function() {             console.log($("#tam-content").load($(that).data("url") + ' ' + $(that).data("target")));             $.getscript("js/slider/slider-animations.js");         }, 1000);     }); }); 

so looks ....

if ((old_ie > -1) || (new_ie > -1)) {     ms_ie = true; } if (ms_ie) {         $("body").on("click", ".slide", function(e) {         e.preventdefault();         var = this;         settimeout(function() {             console.log($("#tam-content").load($(that).data("url") + ' ' + $(that).data("target")));             $.getscript("js/slider/slider-animations.js");         }, 1000);     }); } else {     $("body").on("click", ".slide", function(e) {         e.preventdefault();         $("#mission,#overview,#music,#potential,#people,#expression,#ethos,#cpd,#workshop,#team,#referrals,#local-links,#family,#mental,#palliative,#autism,#schools,#dementia,#private,#acreditations,#definitions,#research,#contact,#email,#phone,#contact-form,#finley,#councelling,#music-performance,#community-music,.slides").addclass("bounceoutup");         var = this;         settimeout(function() {             console.log($("#tam-content").load($(that).data("url") + ' ' + $(that).data("target")));             $.getscript("js/slider/slider-animations.js");         }, 1000);     }); 

but reason doesn't work.. took out document.ready bit , don't think problem unsure.. can ?

hoooray !!

so solution, closing braces needed inside if , else parts split naturally....

if ((old_ie > -1) || (new_ie > -1)) {         ms_ie = true;       }       if ( ms_ie ) {         $("body").on("click", ".slide", function(e){         e.preventdefault();         var = this;         settimeout(function() {         console.log($("#tam-content").load($(that).data("url") + ' ' + $(that).data("target")));         $.getscript("js/slider/slider-animations.js");         }, 1000);         });      }else{         $("body").on("click", ".slide", function(e){         e.preventdefault();         $("#mission,#overview,#music,#potential,#people,#expression,#ethos,#cpd,#workshop,#team,#referrals,#local-links,#family,#mental,#palliative,#autism,#schools,#dementia,#private,#acreditations,#definitions,#research,#contact,#email,#phone,#contact-form,#finley,#councelling,#music-performance,#community-music,.slides").addclass("bounceoutup");         var = this;         settimeout(function() {        console.log($("#tam-content").load($(that).data("url") + ' ' + $(that).data("target")));        $.getscript("js/slider/slider-animations.js");         }, 1000);         });       } 

this great little method of running browser specific code, should check out!


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -