I'm having some difficulty with managing an administration page, where I constantly get an 'Aw Snap' in Chrome.
I have a 'merchandise' administration page where you can add new products to the website.
If the user selects 'T-shirt' as the product type, some new options appear. Namely size and colour.
Size is just a multiple select box but clicking on 'Add Colour' initialises a shadowbox.
The shadowbox allows the user to input a name for the colour and choose a hex colour (via the Wheel Colour Picker plugin) and upload a representative image (via Uploadify). On submission the Uploadify script uploads the file and then upon completion script sends the other colour information to the database via JQuery AJAX.
Submit Button Script:
function add_colour_submit(){
$('#admin-add-colour-response').text('Processing...').fadeIn(1000);
$('#admin-add-colour-image').uploadifySettings('scriptData', {
'title': $('#admin-add-colour-title').val(),
'hex': $('#admin-add-colour-hex').val(),
'gender': $('#admin-add-colour-gender').val()
});
$('#admin-add-colour-image').uploadifyUpload();
}
Uploadify 'On Complete':
'onComplete': function (event, ID, fileObj, response, data) {
$("#admin-add-colour-response").fadeTo(200,0.1,function(){
$("#admin-add-colour-response").html('Complete.').fadeTo(900,1,
function()
{
var responseArray = response.split(',');
var id = responseArray[0];
var title = responseArray[1];
var hex = responseArray[2];
var gender = responseArray[3];
parent.get_colour(id, title, hex, gender);
});
});
}
When the AJAX operation is complete, a feedback message shows 'Complete'.
After this time, the JQuery code closes the shadowbox programatically and on the parent page, a small div to represent the submitted colour is created.
Potential to add multiple using this method.
Get Colour Function:
function get_colour(id, title, hex, gender){
$('#sb-nav-close').click(); //trigger shadowbox close
//create colour object div
var colourObject = '<div class="colourObject"><div class="colourPreview" style="background:#'+hex+'"></div><div class="colourInfo"> '+title+' / '+gender+'</div><div class="colourRemove"><a href="#" onclick="remove_colour('+id+')">x</a></div</div>'
var currentList = $('#colour-list').html();
$('#colour-list').html(currentList+colourObject);
//re-initialise any shadowbox links in the page
Shadowbox.init({
skipSetup: false
});
Shadowbox.setup();
}
My issue is that during the above function, perhaps during the closing of the shadowbox, I get an Aw Snap in Chrome. The screenshots of the colour div above were made using Safari where I have no problems what so ever.
I have several plugins (shadowbox, wheel colour picker, uploadify, jquery) so could a clash of these be causing the error?
Update.
I've just managed to test this in a few more browsers, and it's definitely a problem associated only with Chrome.