Search code examples
jquerycolorbox

Scrolling inside a Colorbox div


I have a Colorbox which opens a hidden div with 2 major divs inside.

<div style="display:hidden">
  <div id="legal">
    <div id="tos">Long html here</div>
    <div id="daten">Another Long html here</div>
  </div>
</div>

Additionally there are 2 separate javascript functions that call the same colorbox from flash:

function invoke_tos() {
  $.colorbox({inline:true, href:'#legal', top: 300});
}
function invoke_daten() {
  $.colorbox({inline:true, href:'#legal', top: 300});
}

what I want is invoke_daten to open the "legal" div but scroll to "daten" section.

Is this possible with colorbox or jquery without using additional plugins? If yes how?


Solution

  • I am also facing same situation as @alexander-nenkov clarified in his follow-up comment: "want to show both nested divs but scroll to second. Something like anchor."

    I believe this is IMPOSSIBLE for inline mode, simply because the traditional anchor notation "#inline_content" has been used by colorbox to trigger inline content, and we can not have "#inline_content#anchor" notation (at the time of writing this post).

    Actually colorbox author, Jack Moore, answered similar question here: "You should be using an iframe". https://groups.google.com/forum/?fromgroups=#!topic/colorbox/O3ZrA8fvjaU