Sticky Header issue in Salesforce Lightening

Hello Amy,    
                   We are on Current brooklyn version.
Let me show the flow, how we are displaying a  record detail.
‘OpportunityDetail’ page has a pageInclude --“OpportunityDetailModel”. The script exist in ‘OpportunityDetailModel’. When I  preview directly from "OpportunityDetailModel’ page, script works, but when I try to go through "OpportunityDetail " page, the script doesn’t work. Since we are displaying “OpportunityDetail”, but we are calling the Script on pageInclude—“OpportunityDetailModel”, window.scroll () function is not executing.
Am I missing something to include on the code ?