jquery fancybox popup call from parent javascript file -
can 1 me how call fancybox popup parent js file. when clik on button 1 function if condition true in function need open fancybox popup. advance thanks..
$(document).ready(function() { $("#external").fancybox({ 'width' : '80%', 'height' : '100%', 'autoscale' : false, 'transitionin' : 'none', 'transitionout' : 'none', 'href' : 'openpopup.html', 'type' : 'iframe' }); }); function clickfancy(){ if(true){ // here need open fancypopup }else(){ } <body> <form name="frm1"> <input type="submit" name="fancy" onclick="clickfancy()"> <button>click me</button> </form> </body> <html>
if initialized fancybox selector
$("#external").fancybox();
then trigger click
within function
function clickfancy() { if (true) { // here need open fancypopup $("#external").trigger("click"); } else { } }
... call function wherever need to. btw <button>click me</button>
nothing wonder why there. also, else()
should else
unless nesting condition else if()
.
edit :
in response edit attempt, function works can see jsfiddle.
what suspect (i mean no offense) have gaps in knowledge of how selectors , javascript condition statements should work , how related html elements.
Comments
Post a Comment