Trigger Content Dock With JavaScript

Hi, is there a way to trigger the content doc with JavaScript?

I’m planning on forwarding URLs from an old site to my new site with Pro Theme. When forwarded, the URLs will be appended with #moved, so I will write a JavaScript function to trigger the Content Dock if #moved is detected in the URL, so that a message appears saying we’ve moved here etc.

Hi There,

Please add this custom CSS under X > Theme Options > CSS:

.x-content-dock.left {
    left: -300px !important;
}

Then you can use this custom JS to trigger the content dock appears:

jQuery('.x-content-dock').removeClass('left');

Let us know how it goes!

Thanks Thai, but I need the JS to trigger the content dock if it finds #moved in the URL of the page…

You can try with this code:

jQuery(document).ready(function($) {
	var hash = window.location.hash.slice(1);
	if( hash  && hash == 'moved'  )
    	$('.x-content-dock').removeClass('left');
});

Hope it helps :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.