Superbegood31 Posted May 28, 2014 Share Posted May 28, 2014 (edited) Hello,I wish to add an anchor in a link "fancybox".The structure of this link : <a class="iframe" href="index.php?id_cms=3&controller=cms&content_only=1">texte</a> I said that I have placed the code snippet in my footer <script type="text/javascript"> $('a.iframe').fancybox({ 'type' : 'iframe', 'width':700 }); </script> On the landing page (id_cms = 3) I placed an anchor and I'd like to open this link is placed on the anchor.I tried to place the anchor directly in the link above but it does not work ...Thank you for your lights. Edited June 30, 2014 by SWITCHBOARD (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 28, 2014 Share Posted May 28, 2014 hello your link, when you check page source contains class="" code ? as far as i remember tinymce removes it can you verify it, please? Link to comment Share on other sites More sharing options...
Superbegood31 Posted May 28, 2014 Author Share Posted May 28, 2014 Hi vekia, The class = "iframe" is present. I tried <a class="iframe" href="index.php?id_cms=3&controller=cms&content_only=1&#licence">text</a> <a class="iframe" href="index.php?id_cms=3&controller=cms&content_only=1" rel="licence">text</a> <a class="iframe" href="index.php?id_cms=3&controller=cms&content_only=1#licence">text</a> but nothing works... Thanks for your help Link to comment Share on other sites More sharing options...
Superbegood31 Posted May 28, 2014 Author Share Posted May 28, 2014 anybody ? Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 4, 2014 Author Share Posted June 4, 2014 Hello Up please Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2014 Share Posted June 4, 2014 $('a.iframe').fancybox({ 'type' : 'iframe', 'width':700 }); try to change this code to: $(document).ready(function(){ $('a.iframe').fancybox({ 'type' : 'iframe', 'width':700 }); }); and if it is possible - please share url to your website. 1 Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 4, 2014 Author Share Posted June 4, 2014 (edited) Hello,Same results ...I said that I already have "fancybox" links work on my product.I wanted to do the same thing but with an anchor and more in the link.Thank you for your helpPS: I sent you the link via PM The link button Edited June 4, 2014 by SWITCHBOARD (see edit history) Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 6, 2014 Author Share Posted June 6, 2014 Hi @vekia: Have you received my PM with my link ? Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 10, 2014 Author Share Posted June 10, 2014 up please Link to comment Share on other sites More sharing options...
vekia Posted June 11, 2014 Share Posted June 11, 2014 hello sorry, i have no idea, probably received but i've got a lot of messages there (im not able to check it, too many messages) can you resend it please? Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 11, 2014 Author Share Posted June 11, 2014 hello PM is not ok my url : http://goo.gl/ce42n6 Thanks Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 18, 2014 Author Share Posted June 18, 2014 up please Link to comment Share on other sites More sharing options...
Superbegood31 Posted June 30, 2014 Author Share Posted June 30, 2014 up please Link to comment Share on other sites More sharing options...
Superbegood31 Posted July 1, 2014 Author Share Posted July 1, 2014 nobody ? Link to comment Share on other sites More sharing options...
ericzon Posted September 6, 2015 Share Posted September 6, 2015 (edited) Hi @Switchboard, I had the same problem but I found a fix to do the trick. If you want to open an iframe with an anchor you can't use directly on the url but it's possible to accomplish by javascript. For example: <a href="{$link->getCMSLink('3')}#myanchor" class="iframe-pv">{l s='My anchored link'}</a> It will work with query parameters and rewrited urls and now it's not necessary to add content_only parameter on your link. My code on global.js file: $(document).ready(function(){ $(document).on('click', 'a.iframe-pv', function(e){ e.preventDefault(); var anchor = ''; var url = $(this).attr('href'); var anchorIdx = url.indexOf('#'); if (anchorIdx > -1) { anchor = url.substring(anchorIdx, url.length); url = url.substring(0, anchorIdx); } if(url.indexOf('content_only=') == -1) { url += (url.indexOf('?') > -1) ? '&' : '?'; url += 'content_only=1'; } if (!!$.prototype.fancybox){ $.fancybox({ 'padding': 20, 'width': '70%', 'height': '70%', 'type': 'iframe', 'href': url + anchor }); } }); }); I've tested on Chrome, FF & IE. I hope it helps Edited September 6, 2015 by ericzon (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now