开发者

jQuery colorbox not showing main box but fading the background

开发者 https://www.devze.com 2023-01-31 11:26 出处:网络
I am using jQuery colorbox to show some HTML content on my website. This has been working fine up until recently but I am now having issues. My Code:

I am using jQuery colorbox to show some HTML content on my website. This has been working fine up until recently but I am now having issues. My Code:

$("[rel^=ShowCrossSell]").colorbox({
            innerWidth: "600",
            innerHeight: "500",
            iframe: true,
            opacity: 0.75,
            title: 'Please select one or more alternatives ...'
        });

and I have a link with a ref of ShowCrossSell_something. This part is working because I get the faded background that the colorbox creates but the main box doesn't show. When I look at the source in FireBug I see the main div has d开发者_JAVA技巧isplay: none set which is causing the issue. Setting this to inline makes my content appear.

My question is, has anyone else experienced this and if so, what was the cause? I have removed all my other jQuery includes I have added recently but this has not helped.

p.s I am only using jQuery as a library .. no others.

Thanks.


My code is used in combination with a jQuery plugin and looks like below. I had the same problem and used the code as follows:

$(document).ready(function(){

    $('#cbox').jflickrfeed({
    limit: 12,
    qstrings: {
        id: 'xxxxxxxxxxx'
    },
    itemTemplate:
    '<li class="flickr">' +
        '<a rel="colorbox" href="{{image}}" title="{{title}}">' +
            '<img src="{{image_s}}" alt="{{title}}" />' +
        '</a>' +
    '</li>'
}, function(data) {
    $('#cbox a').colorbox({ onLoad: function () { $('#colorbox').show(); } });


});

});

Hope this helps.


Try updating your jQuery and colorbox js files.

I was duplicating part of an app to another project and ran into the same issue. When I updated the jQuery version but not the plugin files, issues like this were common.


I have managed to get this working but it is kind of a hack ...

I have add a $("#div").click() function that sets the display to inline. This doesn't answer the "why" part of my question so if someone has any ideas, I would be interested but it sorts the issue out.


I've just started experiencing the same problem on a site which was showing the colorbox fine before but now isn't. I must have done something to break it but after hours of fiddling I'm no closer to finding out what that was.

Although you are probably doing something similar you didn't explicitly say how you made it work so I thought I should point out to any people having the same problems that adding

$("#colorbox").show()

after the call to $.colorbox will make the thing appear. I'm calling colorbox directly but you'd have to hook into the cbox_load event if you're using the more common bind-to-selector method.

No substitute for fixing it properly of course but sometimes the priority is to get the damned thing working.

0

精彩评论

暂无评论...
验证码 换一张
取 消