abhiomkar / portfolio-js

Tiny JavaScript carousel library with horizontal scrolling and all the goodness.
https://portfoliojs.com
80 stars 30 forks source link

Not able to center image with offsetLeft option #33

Open ghost opened 10 years ago

ghost commented 10 years ago

For some reason, I am not able to make the active image centered. You can see it here: http://www.jurasakos.hu/new/portfolio/3-jegyes-fotozas

The code I'm using is the following:

<script>jQuery(document).ready(function() {var p = jQuery("#gallery").portfolio({height: '500px', lightbox: true, loop: true, offsetLeft: -320, opacityLightbox: '0.6', showArrows: false}); p.init();});</script>

Thank you very much for your help in advance!

abhiomkar commented 10 years ago

Please use this offsetLeft option as showed below, please let me know if this works.

<script>
    jQuery(document).ready(function() {
        var p = jQuery("#gallery").portfolio({height: '500px', lightbox: true, loop: true, offsetLeft: -1*($(document.getElementById('gk-content')).offsetLeft + 250), opacityLightbox: '0.6', showArrows: false}); p.init();
    });
</script>
ghost commented 10 years ago

Unfortunately, it is still not working. http://www.jurasakos.hu/new/portfolio/3-jegyes-fotozas

ghost commented 10 years ago

I am trying to set the value dynamically by using "if(e(this).find("img").width()<200){offset:-500}" in the "portfolio.pack.min.js" file, but for some reason it doesn't seem to work. Could you please help me making it possible?