arvgta / ajaxify

Ajaxify - The Ajax Plugin
https://4nf.org/
274 stars 124 forks source link

Specify which DIV to swap depending on selector? #147

Closed ddaaii closed 6 years ago

ddaaii commented 6 years ago

How would I choose which DIVs to replace based on the selector?

Problem:

HTML:

<div>
   <div id='left'><a class='loadToMain'>link#1</a></div>
   <div id='main'>
      <div id='leftMain'></div>
      <div id='rightMain'><a class='loadToLeft'>link#2</a></div>
   </div>
</div>

jQuery:

jQuery('#main').ajaxify({
        selector : ".loadToMain",
    });

jQuery('#leftMain').ajaxify({
        selector : ".loadToLeft",
    });
arvgta commented 6 years ago

Thanks for your interest in the plugin and the good description, of what you would like to do. I'm afraid that won't work.

You're right, that this would require mulitplexing of the Ajaxify call, which is not recommended, because each instance of Ajaxify operates on the whole page and they would interfere with each other...