Pregunta

I'm using shadowbox to open links in an overlaying iframe. If people navigate to mysite.com/#/link123 the link is automatically clicked and opens up in a shadowbox.

    <script type="text/javascript">

    window.onload = function() {

        var pageURL = document.location.href;

        var SBlinkRegEx = /(.*)(\/#\/)(.*)/;
        var SBlinkRegExCG = SBlinkRegEx.exec(pageURL);

        if(SBlinkRegExCG){
           var SBhashtag = "#"+SBlinkRegExCG[3];
           alert(SBhashtag);
           $(SBhashtag).trigger('click');
        }

    }


</script>

This code works perfectly for all links EXCEPT for clickable div's. They show some strange behaviour. When people navigate to mysite.com and click on a clickable, it opens up nicely in the shadowbox. However, if people navigate to mysite.com/#/div123 the shadowbox opens the whole page(mysite.com) instead of just the div. The unwanted behaviour also happens when people navigate to mysite.com/#/link123, then close that shadowbox, and click on the div.

Here's a code from a normal link

<div class="normal-width">
    <a id="link123" onclick="window.history.replaceState( {} , '', '#/link123' );" rel="shadowbox[All]" href="mysite.com/link123.html">Link 123</a>
</div>

Here's the code for my clickable div

<div id="abc" class="text">
        //some content
        <a id="div123" onclick="window.history.replaceState( {} , '', '#/div123' );" href="#abc" rel="shadowbox[All]" class="filldiv"></a>
    </div>

Thanks for your time.

¿Fue útil?

Solución

Figured it out...

rel="shadowbox[All];player=inline"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top