i have so many categories and each category have so many items. like a food website. ok now i want to use fancy box. when burger category was click . i want to show different fancy box. and when kebabas category was clicked i want to show another fancybox.. The category is coming from database.. how can i do this ?

my html code is :

<td width="73" style="text-align:right;"><a href="#inline" class="modalbox" onClick="insert(<?php echo $viewItem['item_id']; ?>);"><img src="_assets/images/add.gif" /></a>

    </td>

fancybox :

<!-- hidden inline form -->
<div id="inline">
    <h3>Please select any salad or sauce</h3>
<form id="contact" name="contact" action="#" method="post">

    <p>
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_0" />
        Ketchup</label>
     &nbsp; &nbsp; &nbsp;
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_1" />
        Mayonnaise</label>
      &nbsp; &nbsp; &nbsp;
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_2" />
        Mint</label>
      <br />
       <br />
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_2" />
        Yogurt</label>
       &nbsp; &nbsp; &nbsp;
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_2" />
        Garlic</label>
      &nbsp; &nbsp; &nbsp;
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_2" />
        Mayo</label>
      &nbsp; &nbsp; &nbsp;
      <label>
        <input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_2" />
        BBQ</label>
      <br />
    </p>
    <button id="send" onclick="$.fancybox.close();">Select</button>
  </form>
</div>

jquery:

if(result[4] == 7 || result[4] == 8){
$(".modalbox").fancybox();}
else{

}
}

By different fancy box you mean different styles?

Are you getting the data through AJAX call?

By the way, can you clarify if you're using This

Dear, AleMonteiro

i dont need a different style. actually i want to show when burger has clicked so the fancy box option like this saus, yoguart, chilli .. and when cold drink has clicked the fancy box option like coca colla, pepse, merinda etc.

gon1387 yes i m getting the data using ajax

gon1387, yes i m using this fancybox which you linked

i have done my own.

td width="73" style="text-align:right;"><a href="<?php if($catId == 7) { ?> #inline <?php } elseif($catId == 6) { ?> #in <?php } else { ?> # <?php } ?>" class="modalbox" onClick="insert(<?php echo $viewItem['item_id']; ?>);"><img src="_assets/images/add.gif" /></a>

I would suggest to you to change the href with JavaScrit, but it'll work too doing in the back-end.

Dear AleMonteiro,

can you please give me some example. how can i do in the back-end

The way you did is on the back-end, using PHP to set the href.
Isn't that working?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.