Jquery having two effects on same div!
Hi all!
I am new to Jquery so go easy on me! I have written a bit of code that works for the most part, however, when the #JSb is clicked it can trigger two different actions when clicked...but I only created one! When you click anywere but the top left corner of the div the entire screen fades out (this is not the effect that I want). If you click in the top left corner the action that I want actually occurs. I have this working for 4 other divs perfectly and no matter how many times I go through the code or copy and paste over this code it continues to have the same problem. Please help!
Here is the JQuery code:
- amtzoom = 1.8;
- scfadein = 1000;
-
- $(document).ready(function() {
- $('#JSlc').click(function(e) {
- //e.preventDefault();
- e.stopPropagation();
- ojst = parseInt($(this).css('top'));
- ojsl = parseInt($(this).css('left'));
-
- var clcw = ($(window).width() - $(this).width()*amtzoom)/2;
- var clch = ($(window).height() - $(this).height()*amtzoom)/2;
- var lch = parseInt($(this).css('height'));
- ojslch = lch + "px";
- var nlch = lch * amtzoom + "px";
- var lcw = parseInt($(this).css('width'));
- ojslcw = lcw + "px";
- var nlcw = lcw * amtzoom + "px";
- var cflc = parseInt($(this).css('font-size'));
- ojsflc = cflc + "px";
- var nflc = cflc + 12 + "px";
-
- $(this).css({'overflow':'visible'});
-
- $(this).siblings().animate({'opacity':"0"},300);
- $(this).animate({
- 'font-size': nflc,
- 'height': nlch,
- 'width': nlcw,
- 'top': clch + 'px',
- 'left': clcw + 'px'
- },300, function(){
-
- $('#JSb').animate({'opacity':"1"},scfadein);
- $('#JSscl').delay(100).animate({'opacity':"1"},scfadein);
- $('#JSscul').delay(200).animate({'opacity':"1"},scfadein);
- $('#JSscu').delay(300).animate({'opacity':"1"},scfadein);
- $('#JSscur').delay(400).animate({'opacity':"1"},scfadein);
- $('#JSscr').delay(500).animate({'opacity':"1"},scfadein);
- $('#JSscrd').delay(600).animate({'opacity':"1"},scfadein);
- //$('#JSscd').delay(700).animate({'opacity':"1"},scfadein);
- });
- });
- });
-
- $(document).ready(function() {
- $('#JSb').click(function(e) {
- //e.preventDefault();
- e.stopPropagation();
- //$('#JSscd').animate({'opacity':"0"},scfadein);
- $('#JSscrd').delay(100).animate({'opacity':"0"},scfadein);
- $('#JSscr').delay(200).animate({'opacity':"0"},scfadein);
- $('#JSscur').delay(300).animate({'opacity':"0"},scfadein);
- $('#JSscu').delay(400).animate({'opacity':"0"},scfadein);
- $('#JSscul').delay(500).animate({'opacity':"0"},scfadein);
- $('#JSscl').delay(600).animate({'opacity':"0"},scfadein);
- $('#JSb').delay(700).animate({'opacity':"0"},scfadein, function() {
-
- $('#JSlc').css({'overflow':'hidden'});
- $('#JSlc').animate({
- 'font-size': ojsflc,
- 'height': ojslch,
- 'width': ojslcw,
- 'top': ojst + 'px',
- 'left': ojsl + 'px'
- },300);
- $('#JSlc').siblings().animate({'opacity':"1"},300);
- });
- });