我想我遇到了这个问题,因为图像缩放(glassCase)放置在加载时不可见的选项卡上(显示:无;)。因此,当计算组件的宽度时,它的值是 0。
这意味着当我单击选项卡式面板时,元素没有宽度。一旦我调整浏览器大小,它就会正确显示。我只在单击性能选项卡后尝试调用 jQuery 缩放,但它似乎仍然无法正常工作。
这是我的开发网站
http://ecclesall-road.co.uk/products/casement-windows/
并且图像缩放位于性能选项卡下。任何帮助将非常感激。
这是我的代码
jQuery.jQueryTab({
responsive: true, // enable accordian on smaller screens
collapsible: true, // allow all accordions to collapse
useCookie: false, // remember last active tab using cookie
openOnhover: false, // open tab on hover
initialTab: 1, // tab to open initially; start count at 1 not 0
cookieName: 'active-tab', // name of the cookie set to remember last active tab
cookieExpires: 4, // when it expires in days or standard UTC time
cookiePath: '/', // path on which cookie is accessible
cookieDomain: '', // domain of the cookie
cookieSecure: false, // enable secure cookie - requires https connection to transfer
tabClass: 'tabs', // class of the tabs
headerClass: 'accordion_tabs', // class of the header of accordion on smaller screens
contentClass: 'tab_content', // class of container
activeClass: 'active', // name of the class used for active tab
tabTransition: 'fade', // transitions to use - normal or fade
tabIntime: 0, // time for animation IN (1000 = 1s)
tabOuttime: 0, // time for animation OUT (1000 = 1s)
accordionTransition: 'slide', // transitions to use - normal or slide
accordionIntime: 500, // time for animation IN (1000 = 1s)
accordionOuttime: 400, // time for animation OUT (1000 = 1s)
before: function () {}, // function to call before tab is opened
after: initGC // function to call after tab is opened
});
function initGC() {
if (jQuery(this).attr('href') === '#performance' && !jQuery(this).hasClass('gc-init')) {
jQuery(this).addClass('gc-init');
jQuery('#glasscase').glassCase();
jQuery('#glasscase2').glassCase();
jQuery('#glasscase3').glassCase();
jQuery('#glasscase4').glassCase();
}
}