djax icon indicating copy to clipboard operation
djax copied to clipboard

Bind unique links or something?

Open CyrilKrylatov opened this issue 11 years ago • 5 comments

Hello Beezee,

First of all, thank you a lot for this lil' plugin.

Secondly, I have an issue with it.

Indeed, I'd like to say to djax to only bind (then change via ajax method) only links on a DOM elements.

Let me clear this out if that's not (French guy, poor english here) :

I have:

<div class="menu">
<a class="menu__item menu--homepage" href="{URL homepage Site}">Go back to the homepage</a>
<ul class="menu__item">
<li><a href="{URL Portfolio}">Portfolio me</a></li>
<li><a href="{URL Contact}">Contact me</a></li>
</ul>
</div>

How can I say to djax to only bind the links from ul.menu__item but NOT a.menu--homepage ? Because I have an other template for my homepage and I don't want it to be loaded via djax.

Oh and I'm working with WordPress here.

Thank you for your concern.

CyrilKrylatov avatar Dec 01 '13 19:12 CyrilKrylatov

Well, I've figure sth out that should works:

I added this:

if (!$(element).attr("data-djax")) { }

In the .attachClick function.

Not sure if that's the best?

CyrilKrylatov avatar Dec 01 '13 19:12 CyrilKrylatov

@DaPo it's a good feature request, should be supported by an option you can configure without having to modify code. I'll try to look into this soon.

beezee avatar Dec 02 '13 04:12 beezee

@beezee yep, why not have the possibility to exclude .indexOf links AND DOM elements ? Or, on the last parameters, if there is, ONLY include DOM elements.

Should be great.

CyrilKrylatov avatar Dec 02 '13 07:12 CyrilKrylatov

hi i found a solution for this prob but it's not a real solition :)

u can reload the page, just for index or inline "a" code where u use "rel=reloadpageopen" like a class and u sould add this code at the first

$('body').on('click', 'a[rel^=reloadpageopen], area[rel^=reloadpageopen]', function(e) { window.location= $(this).attr('href'); return false; });

akinayturan avatar Aug 25 '14 09:08 akinayturan

@epfarki sounds legit too, but I'm waiting for something more natural from @beezee :)

Thank you anyway!

CyrilKrylatov avatar Sep 01 '14 09:09 CyrilKrylatov