Try to isolate the issue. Copy the code that you have issues with and paste it into the clean page template.
Can you still reproduce the issue? If no - than you are missing some code from the main template. If you still can reproduce the issue than continue reading.
Now you need to start removing parts that you think are irrelevant. You should remove parts one by one with fairly small pieces of code. Refresh the page after each code remove and check if you still can reproduce the issue.
Can you still reproduce the issue? If yes - try to remove the next piece of code. If no - bring the last removed piece of code (with Ctrl+Z or what ever hot key is in your laptop). Now you found the piece of code where the issue might be. This should give you a clue to locate the issue and ways to fix it.