On the page there is a link http: // my site / index.php? Id = 20 when you click on it, a fancybox pops up with an add form, how to prevent this window from opening through -> right mouse button -> open a link in a new window? If this is done, there will be a bare, ugly page on which nothing but a form will appear.
1 answer
The element that opens fancybox's popup does not have to be a link. You can generally open the popup anytime, calling it directly.
Look at the code below: instead of a link, I made a “button” with a regular div with a picture inside. And in its click handler function, I open the pop-up fancybox.
$(".fancybox").on('click', function(){ $.fancybox({ href: $(this).data('href') }); }); <link href="http://fancyapps.com/fancybox/source/jquery.fancybox.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script> <div class="fancybox" data-href="http://fancyapps.com/fancybox/demo/1_b.jpg"><img src="http://fancyapps.com/fancybox/demo/1_s.jpg" alt=""/></div> |
<a>, but through<button>- right-click on it does not work - lexxl