The below code is not working and also I have to implement two things 1) need to disable the default close button with my own custom button which i had written ‘tpl’:{} but it’s not working. 2) while selecting the radio button it’s not showing checked. can anyone help on these things.
The fancybox wasn’t loading because of a javascript error trying to load the min jQuery. I changed the two js links to the ones in the example script, and the fancybox loaded (after I added the comma after the iframe parameter to fix that error, of course)
While selecting checkbox it’s not showing checked, did you identified that, it’s the main issue.
Can you know what’s the reason and any alternative for that.
No clue. You’re hiding the actual radio button with css, but I fail to see where what you see is being created. It may be Monday, but I’m not seeing what’s creating the radio button you’re seeing.
I’ll have to think about it, but if anyone else sees what I’m missing, hopefully they’ll jump in - I’m guessing it’s something blatantly obvious since those typically give me the most fits, but I’m not seeing it at the moment…
@DaveMaxwell Thanks for prompt response and effort.
I have tried to modified the default radio button styles with css3 it’s working, after implementing the fancybox modal window the radio checked styles are not applying.
Just remove the inline javascript and check it’s working.
The main criteria is while selecting the radio button need to show fancy modal window and need to customize the default radio button this way i tried but machine failed Let me know if you have any thoughts to implement that.
Fancybox is designed to prevent the default action.
The only way for it to not prevent the default action is for its .open() method to return false, which only occurs when the _start() method returns false. That occurs only when there is no href reference, or when there is no type provided.
Unless you edit the fancybox code directly (which is not advised), I don’t think that there is any way to avoid it preventing the default action.
As such, the only viable solution seems to be for us to perform that default action directly instead, which we can force from the end of the fancybox code.
Here’s the magic:
var id = $(evt.target).attr("for");
$("#" + id).prop("checked", true);
and here’s how you would use it in context, after the fancybox code:
'tpl': { closeBtn: '<div title="Close" class="fancybox-item fancybox-close">X</div>' }
}).on("click", function (evt) {
var id = $(evt.target).attr("for");
$("#" + id).prop("checked", true);
});
@Paul_Wilkins: Really appreciate your help here, it’s working. Kudos!!!
Instead of getting attribute simply adding one class like below, but the main thing I didn’t notified that how to remove the class after closing the modal window. I am not sure how to do that.
Anyhow learned alot from you, any workaround to remove the class let me know
.on(“click”, function (evt) { $(‘#radio_check’).addClass(‘radio_chk’); });