خرید بک لینک

Vote count: 0

I have a trouble with a phonegap build, a function run two time (on my mobile with the phonegap build), differently when i execute the script on firefox.

Thats a part of my code :

        $(".blackcase").click(function (e) 
            {
                if (elemIsEmpty($(this)) && isSelected("black")) 
                {
                    retu;
                }

                if(isSelected("white")) 
                {
                    //swap white to black
                    alert("swap b to w");
                    if($(this).html() == valueoffirst.html())
                    {
                      $(valueoffirst.html(""));
                      alert("swap   b to w1");
                    }

                    else
                    {
                      swapValuesFromTo($("#"+selectedCase.id), $(this));
                      alert("swap b to w 2");
                    }

                    clearSelectedCase();
                    removeSelectionWithRed();
                    retu;
                }

                if (isSelected("black")) 

                {
                  alert("swap b to b");
                    $("#"+selectedCase.id).removeClass('red'); 
                    if($(this).html() == valueoffirst.html() &&  $(this).attr('id') != valueoffirst.attr('id'))
                    {
                      $(valueoffirst.html(""));
                      alert("swap   b to b1");
                    }

                    else
                    {
                      swapValuesFromTo($("#"+selectedCase.id), $(this));
                      alert("swap b to b 2");
                    }

                    clearSelectedCase();
                    removeSelectionWithRed();
                    retu;
                }

                //alert("black is selected");
                selectWithRed($(this));
                updateSelectedCase("black", $(this).attr("id"), $(this).html());
                valueoffirst = $(this);

            });

             function removeSelectionWithRed() 
            {
               $('div').removeClass('red'); 
            }

            function selectWithRed(element) 
            {
                removeSelectionWithRed();
                element.addClass('red');
            }

            function updateSelectedCase(color, id) 
            {
                selectedCase.color = color;
                selectedCase.id = id;
            }

            function moveValueFromTo(elemFrom, elemTo) 
            {
                elemTo.html(elemFrom.html());
                setValueToElem("", elemFrom);
            }

            function setValueToElem(value, elem) 
            {
                elem.html(value);
            }

            function swapValuesFromTo(elemFrom, elemTo) 
            {
                var fromValue = elemFrom.html();
                var toValue = elemTo.html();
                setValueToElem(fromValue, elemTo);
                setValueToElem(toValue, elemFrom);
            }

            function isSelected(color) 
            {
                retu selectedCase.color == color;
            }

            function clearSelectedCase() 
            {
                selectedCase.color = "";
                selectedCase.id = "";
            }

            function elemIsEmpty(elem) 
            {
               retu elem.html().length == 0;
            }

When i run my code on firefox, if i click on black case then on another blackcase, it's swapping the values and i have two alerts :

swap b to b

Swap b to b2

All is ok, but on my mobile with my phongap build test, if i click on blackcase then another blackcase the values don't swap and i have 4 alerts :

swap b to b

Swap b to b2

swap b to b

Swap b to b2

So i think values swap but reswap so values are sames of the starting values (like nothing changing).

Thanks a lot for your help !

asked 39 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 13 ارديبهشت 1395 ساعت: 6:39

صفحه بندی