English 中文(简体)
Hide the close "X" button in Fancybox
原标题:

I am using this http://fancybox.net/

Is there a way to add a property to not show the close "X" button on top right? I mean I can use callbackOnShow to hide it in a hide() but that is not fast enough. I want it NOT rendered out instead of rendered then hide.

最佳回答

If you take a look at the documentation at http://fancybox.net/api it cites an option of showCloseButton that should do the trick.

From the site:

showCloseButton - Option to show/hide close button

问题回答

Looks like showCloseButton doesn t work any more. After looking into the fancybox code i figured out closeBtn should be set to false.

So in order to hide close button one should add below line in options -

closeBtn : false

In fancybox 3 use modal e.g.

        $.fancybox.open({
            ...
            opts: {
                modal: true,
            }
        });

For those who are looking for disable it completely in fancybox v3, here it is:

smallBtn: false,
toolbar: false

use boolean in showCloseButton attribute. e.g

$( .editGnBtn ).fancybox({
    href : "#editGn",
    showCloseButton :false
 });

You can add the following in ... .fancybox-close {display:none; }

But it is advisable only if the same fancybox is a popup which will automatically disappear after some time (using $.fancybox.close();)

Try it, to never close the windows in fancybox v4:

Fancybox.show(gallery, {
    Toolbar: {
        display: [
            { id: "counter", position: "center" },
            "fullscreen",
        ],
    },
     closeButton :   ,
     infinite : false,
     click :  next ,
     dragToClose : false,
    keyboard: {
        Escape: "false",
        Delete: "false",
        Backspace: "false",
        PageUp: "next",
        PageDown: "prev",
        ArrowUp: "next",
        ArrowDown: "prev",
        ArrowRight: "next",
        ArrowLeft: "prev",
    }
});




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签