开发者

Fancybox on checkbox showing an iFrame

开发者 https://www.devze.com 2023-04-11 15:28 出处:网络
Currently I\'m working on a advertisement website where people can sign-up their company/accomodation. So now I made a checkbox where people have to accept it before you can register your compny. Beca

Currently I'm working on a advertisement website where people can sign-up their company/accomodation. So now I made a checkbox where people have to accept it before you can register your compny. Because an window.load() will not work for every browser (ie > popupblocker etc.) I've got to find another way.

Fancybox supports showing iFramed content inside their fancy box (how fine!). This is working on a simple a href.. now I want to accomplish the same results at a checkbox. When people select the checkbox, the Terms and conditions should be showed inside the fancy box. T&C are saved inside a html side.

    $("#plaatsing").fancybox({
    'hideOnContentClick': true
    });
    });

The code above works for a <a href=""> , not for a checkbox.. Can somebody help me with this problem?

When i apply the plaatsing ID开发者_如何转开发 on my checkbox, it shows a nice checkbox inside the fancybox. How can I make it show the .html page?


EDIT

Found a solution for FF + Chrome.. not working in IE ofc.

JS:

 $("a#controle").fancybox({
      'hideOnContentClick': true
 });

HTML:

input onclick="$('a#controle').trigger('click');" name="plaatsing" id="plaatsing" type="checkbox" />

Works.. but not for IE :'(!


What if you use #("#plaatsing") with .click() ?

$(function(){
      $("#plaatsing").click(function(){
            if($(this).is(':checked')) $('a#controle').trigger('click');
      });
});

Or I think you can use .change() too instead of .click()!

Just I used checkbox before for agreement box, that if that checkbox checked, show register link, so I think that will work with you "Hopefully that", but I'm not sure if the same way will work with fancybox & .trigger(), I read that .trigger() has a problem with "onclick" with IE or something like that, anyway try my solution :)

0

精彩评论

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