Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jcrop javascript works in firefox but not in IE
Old 03-05-2009, 10:39 AM jcrop javascript works in firefox but not in IE
Novice Talker

Posts: 14
Trades: 0
im not too good with javascript,
im using jcrop cropping tool, i made some changes to the script which seem to be fine with firefox, but it doesnt work in Internet explorer,
can someone identify if i have any syntax problems in this code,

thanks

link to the page,
http://www.yourwallart.co.uk/croppin...pping/baby.jpg

in firefox, the cropping box appears, but in IE it doesnt

Note: Cute, But Not my BABY!

Code:
<script src="/js/jquery.pack.js"></script>
        <script src="/js/jquery.Jcrop.pack.js"></script>
        <link rel="stylesheet" href="/css/jquery.Jcrop.css" type="text/css" />
        

        <script language="Javascript">

            $(window).load(function(){

                var api = $.Jcrop('#cropbox',{
                    setSelect: [ 0, 0, 200000, 200000 ],
                    onSelect: updateCoords,
                    onChange: updateCoords,
                    <?php 
                    if($_GET['size'] == 200200){
                    echo 'aspectRatio: 1';
                    }
                    ?>
                    <?php 
                    if($_GET['size'] == 300400){
                    echo 'aspectRatio: 3 / 4';
                    }
                    ?>
                    <?php 
                    if($_GET['size'] == 400300){
                    echo 'aspectRatio: 4 / 3';
                    }
                    ?>
                    <?php 
                    if($_GET['size'] == 500500){
                    echo 'aspectRatio: 1';
                    }
                    ?>
                    <?php 
                    if($_GET['size'] == 8001000){
                    echo 'aspectRatio: 4 / 5';
                    }
                    ?>
                    <?php 
                    if($_GET['size'] == 1000800){
                    echo 'aspectRatio: 5 / 4';
                    }
                    ?>

                });
                var i, ac;

                // A handler to kill the action
                function nothing(e)
                {
                    e.stopPropagation();
                    e.preventDefault();
                    return false;
                };

                // Returns event handler for animation callback
                function anim_handler(ac)
                {
                    return function(e) {
                        api.animateTo(ac);
                        return nothing(e);
                    };
                };

                // Setup some coordinates for animation
                var ac =
                {
                    anim1: [0,0,200,20000] ,
                    anim2: [0,0,150,200],
                    anim3: [0,0,200,200],
                    anim4: [0,0,160,200],
                    anim5: [80,160,500,190],
                    
                };

                // Attach respective event handlers
                for(i in ac) jQuery('#'+i).click(anim_handler(ac[i]));

                // Attach another one manually, to demonstrate "set" w/o animation
                jQuery('#setsel').click(function(e) {
                    api.setSelect( [ 200, 200, 300, 300 ] );
                    
                    return nothing(e);
        });
            $(function(){

                $('#cropbox').Jcrop({
                    aspectRatio: 1,
                    onSelect: updateCoords
                });

            });

            function updateCoords(c)
            {
                $('#x').val(c.x);
                $('#y').val(c.y);
                $('#w').val(c.w);
                $('#h').val(c.h);
            };

            function checkCoords()
            {
                if (parseInt($('#x').val())) return true;
                alert('Please select a crop region then press submit.');
                return false;
            };
        

            });
        </script>
__________________

Please login or register to view this content. Registration is FREE

Last edited by grgprint; 03-05-2009 at 10:43 AM.. Reason: spelling mistake
grgprint is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-05-2009, 11:09 AM Re: jcrop javascript works in firefox but not in IE
Novice Talker

Posts: 14
Trades: 0
got it working,
should not have a comma on the end of the last line!

thanks anyway
__________________

Please login or register to view this content. Registration is FREE
grgprint is offline
Reply With Quote
View Public Profile
 
Old 03-05-2009, 11:35 AM Re: jcrop javascript works in firefox but not in IE
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Yeah, that will do it. Been there. Having a comma at the end of an object list is incorrect, but Firefox chooses to ignore it.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to jcrop javascript works in firefox but not in IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28938 seconds with 12 queries