A
A
Aleksandr2016-04-19 11:07:22
JavaScript
Aleksandr, 2016-04-19 11:07:22

Fancybox overlay color change?

A question. There are 2 popup-windows on the page (different). But they are loaded in the same way. Tell me please. How can I change the color of the overlay when the second popup is called?

open: function(e) {
        var view = this
        e.preventDefault()
        var self = $(e.currentTarget)
        var src = self.attr('data-open')
        var href = self.href
        if (src.substr(0, 1) === '#') {
            $.fancybox($(src).html(), {
                type: 'html'
            });
        } else {
            $.fancybox.showLoading()
            $.ajax({
                type: 'get',
                cashe: false,
                url: src,
                data: {
                    'ajax': '1'
                }
            })
                .done(function(data) {
                    var data = $(data)
                    $(data).find('form').bind('submit', function(e) {
                        view.submitAjax(e)
                    })
                    $.fancybox(data)
                })
                .fail(function() {
                    $.fancybox.hideLoading()
                    alert('("' + src + '") окно не доступно,\nбудет выполнена переадресация')
                    window.location.href = href
                })
        }


    },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-04-20
@hector2009

First popup that is static:
$.fancybox($(src).html(), {
type: 'html',
helpers : {
overlay: {
opacity: 0.5,
css: {'background-color': 'yellow'}
}
}
});
The second one is AJAX:
$.fancybox(data,{
helpers : {
overlay: {
opacity: 0.5,
css: {'background-color': '#ff0000'}
}
}
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question