0

edited/updated I need to open this popup when visit home page only..

I tried javascript but doesn't work here..

if ( window.location.pathname == '/' ){
 $( window ).load(function() {
     openFeedbackWindow('feedback_information')

    });
}

I tried more .. like

window.location.href

and php code also in footer.phtml where I load this block..

if(basename($_SERVER['PHP_SELF']=='mywebsiteurl'); ){
load block... 
}

window.location

I need to open this popup when website load now it's open by click on left sidebar button.

enter image description here

here is my code where this popup is triggered..

 <div class="side-feedback">
         <a href="javascript:void(0)" onclick="openFeedbackWindow('feedback_information')" title="Feedback" id="link_feedback"></a> 
    </div>

I try this..

  $( window ).load(function() {
     openFeedbackWindow('feedback_information')

    });
2
  • Normally you would do this by calling the function that displays the popup with a setTimeout() after the page loads or something. Could you explain a little what you've tried or what your set up is? Commented Oct 8, 2016 at 23:56
  • @bassplayer7 I try this.. ( update my question) Commented Oct 13, 2016 at 7:28

2 Answers 2

1

you can try below code it will click your sidebar and popup will load

jQuery( window ).load(function() {
   jQuery('.cms-index-index .side-feedback a').get(0).click();
});
6
  • need to load homepage only.. Commented Oct 25, 2016 at 6:50
  • please check my updated answer Commented Oct 25, 2016 at 6:52
  • No it's not working Commented Oct 25, 2016 at 14:46
  • what is class in body in home page please check and let me know Commented Oct 25, 2016 at 15:42
  • cms-index-index cms-homepage1 offcanvas-container layout-fullwidth fs Commented Oct 25, 2016 at 18:25
0

You can paste the JavaScript snippet below into the content of your CMS homepage...

<script>
    document.observe("dom:loaded", function() {
        setTimeout(function() {
            openFeedbackWindow('feedback_information');
        }, 3000); // 3 seconds
    });
</script>

A better way would be to create a template using the above snippet then render it in the cms_index_index layout handle. This method should reduce the risk of content editors breaking the JS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.