I working on trying to get my condense my code in jquery I have a small chunk of code that is being reused over and over inside of a function, I would like to turn this:
- $(document).ready(function () {
$("a.transitionWhite000").fancybox({ - 'overlayColor': '#FFF',
'overlayShow': true,
'transitionIn': 'fade',
'speedIn': 1300,
'transitionOut': 'fade',
'speedOut': 600,
'overlayOpacity': 0.970,
}); - $("a.transitionBlack000").fancybox({
- 'overlayColor': '#000',
'overlayShow': true,
'transitionIn': 'fade',
'speedIn': 1300,
'transitionOut': 'fade',
'speedOut': 600,
'overlayOpacity': 0.970,
}); - });
Into this:
- var masterSettings000 = 'overlayShow':true,'transitionIn':'fade','speedIn':1300,'transitionOut':'fade','speedOut':600,'overlayOpacity':0.970,
- $(document).ready(function () {
$("a.transitionWhite000").fancybox({
'overlayColor': '#FFF'
masterSettings000,
}); - $(document).ready(function () {
$("a.transitionBlack000").fancybox({
'overlayColor': '#000'
masterSettings000,
}); - });
so far when I try to plug in my 'masterSetting000' var it makes the whole code break, I'm really quite new to all this web development so I guess my first question is, is what I'm trying to accomplish even possible here?
And then secondly how would I execute it?
Thank you in advance for any assistance you can offer.
John