jQuery(document).ready(function() { if(jQuery("body").hasClass("post-php")) { fwEvents.on("fw:options:init", function(data) { if(jQuery("body").hasClass("modal-open") && data.$elements.length > 0 && jQuery("#fw-backend-option-fw-edit-options-modal-background_type", data.$elements).length > 0) { var updateBgVisibility = function() { var $modal = jQuery(".fw-options-modal"); var selection = jQuery("#fw-backend-option-fw-edit-options-modal-background_type .fw-option-type-select", $modal).val(); switch(selection) { case 'color': jQuery("#fw-backend-option-fw-edit-options-modal-background_color", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-background_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-parallax_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_mp4", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_webm", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_poster", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_overlay", $modal).hide(); break; case 'image': jQuery("#fw-backend-option-fw-edit-options-modal-background_color", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-background_image", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-parallax_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_mp4", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_webm", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_poster", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_overlay", $modal).hide(); break; case 'parallax': jQuery("#fw-backend-option-fw-edit-options-modal-background_color", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-parallax_image", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_mp4", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_webm", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_poster", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_overlay", $modal).show(); break; case 'video': jQuery("#fw-backend-option-fw-edit-options-modal-background_color", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-parallax_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_mp4", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_webm", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-video_poster", $modal).show(); jQuery("#fw-backend-option-fw-edit-options-modal-background_overlay", $modal).show(); break; default: jQuery("#fw-backend-option-fw-edit-options-modal-background_color", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-parallax_image", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_mp4", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_background_webm", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-video_poster", $modal).hide(); jQuery("#fw-backend-option-fw-edit-options-modal-background_overlay", $modal).hide(); break; } } updateBgVisibility(); jQuery("#fw-backend-option-fw-edit-options-modal-background_type").on("change", updateBgVisibility); } }); } });