Post by Opencartleerling » Tue Apr 19, 2016 10:21 pm

So to improve the mobile view I made some changes to my webshop. For example I want the product title and reviews to appear above the product photo's. So far so good.

The tab-review opens when someone clicks on reviews or on give a review, but this happens lower on the page so I have to add a scroll function. I tried to accomplish this by in product.tpl adding the below code to the click function (2 times)

Code: Select all

document.getElementById('tab-review').scrollIntoView();
So basically this code

Code: Select all

<a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;"><?php echo $reviews; ?></a> / <a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;"><?php echo $text_write; ?></a></p>
Changes into

Code: Select all

<a href="" onclick=" document.getElementById('tab-review').scrollIntoView();$('a[href=\'#tab-review\']').trigger('click'); return false;"><?php echo $reviews; ?></a> / <a href="" onclick=" document.getElementById('tab-review').scrollIntoView();$('a[href=\'#tab-review\']').trigger('click'); return false;"><?php echo $text_write; ?></a></p>
The result is the "reviews" and "write a review" link now work, but not on the first click. When one of these 2 links is clicked it does not work the first time, but it works as it should after that first click is made.

How can I fix this so the links work properly immediately?

New member

Posts

Joined
Thu May 21, 2015 12:08 am

Post by viethemes » Tue Apr 19, 2016 10:48 pm

Could you provide your site URL so we can take a look at it closer?

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by Opencartleerling » Wed Apr 20, 2016 9:32 pm

Sure, here is a link to a product
https://www.sieradendirect.nl/kettingen ... ing-strass

You would have to check it in mobile view. I changed the location so you would have to check the links
1 Review(s) / Schrijf een review at the bottem of the product page.

There also still is a
1 Review(s) / Schrijf een review links on the top of the page, but this is just a copy with the same ID, so not working..

New member

Posts

Joined
Thu May 21, 2015 12:08 am

Post by straightlight » Sat Aug 06, 2016 6:33 pm

This topic will be moved to the Template Support section of the forum.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot] and 10 guests