Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6655845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:34:12+00:00 2026-05-26T01:34:12+00:00

I have an .Net 4, MVC 3 site that utilizes the jquery Colorbox plug

  • 0

I have an .Net 4, MVC 3 site that utilizes the jquery Colorbox plug in. Everything works as expected, however, I want to allow individual <a> tags to customize the options of the colorbox.

On the web page is an <a> tag:

    <a class="AddNewItem" 
       href="@Url.Action("Create", "Phone", new { masterSID = ViewData["MasterSID"] })"
       cboxOptions='transition: "fade", scrolling: false, overlayClose: false, height: "100%"'>
        Add Phone
    <a>

In a js file I have the following code:

$(document).ready(function () {

    $(".AddNewItem").colorbox($.extend({ title: "Add New Item" },
                                   SetCboxOptions($(this))
                             )
    );
});

function SetCboxOptions(obj) {
    var options = {};

    if ($(obj).attr("cboxOptions") != undefined) {
        var hash;
        var hashes = $(obj).attr("cboxOptions").replace(' ', '').split(',');
        for (var i = 0; i < hashes.length; i++) {
            hash = hashes[i].split(':');
            options[hash[0]] = hash[1];
        }
    }

    return options;
}

When i click the link, a pop-up windows appears with the correct form generated by calling /Phone/Create?masterSID=#. Validation works, and submitting works.

Here is the problem

None of the options set in the <a> tag’s cboxOptions attribute take effect on the Colorbox. I am using code from the Colorbox website that states this should work. Can anyone point out why it isn’t?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:34:13+00:00Added an answer on May 26, 2026 at 1:34 am

    I suggest using the HTML5 data attribute to create an attribute to store your desired settings object in JSON format. Example:

    <a class="AddNewItem" href="@Url.Action("Create", "Phone", new { masterSID = ViewData["MasterSID"] })" data-cbox='{"transition":"fade", "height":"100%"}'>Add Phone<a>
    
    $(".AddNewItem").each(function(){
        var settings = $(this).attr('data-cbox');
    
        if (settings) {
            settings = $.parseJSON(settings);
        }
    
        $(this).colorbox(settings || {});
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net mvc 3 site running locally and everything works fine. I
I have an ASP:NET MVC 2 web site that is on SSL. I want
I have a asp.net mvc site that references a couple of libraries. Recently I
I have an ASP.NET MVC site and ELMAH is showing me that my site
I have an Asp.net Mvc site where I want to give a separate access
I have an ASP.NET MVC site that uses both Microsoft Ajax [ Ajax.BeginForm() ]
I have asp.net mvc intranet site that is deployed to IIS6. Site is used
I have a simple form on an ASP.NET MVC site that I'm building. This
i have an asp.net mvc site and i have a controller action that emails
I have a ASP.NET MVC site that is locked down using Forms Authentication. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.