jquery - Specifying the href property of colorbox when colorbox is triggered -


is possible specify target url colorbox @ time of clicking actual button triggers colorbox.

at moment have in document bind function:

$(function () {     $(".button").colorbox({ width: "50%", height: "50%%", iframe: true, href: "/abc", opacity: 0.6 }); }); 

however, href property depends on value of dropdown list not know when first bind colorbox button.

your way... approach bypasses plugin's automatic onclick handling. call plugin on own event after figure out href value want use.

in code snippet below, var myhref static, you write bit of js set data source.

btw, think have typo on height property - duplicate % signs??

<script>         $(document).ready(function(){             $('.button').click( function() {                 var myhref = "/somehref";                 $.colorbox({                     width: "50%",                      height: "50%",                      iframe: true,                      href: myhref,                      opacity: 0.6                 });                          });         });              </script> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -