1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ExtLoader - xfInsert: some hidden elements are displayed

Discussion in 'XenForo Development Discussions' started by cclaerhout, Oct 1, 2013.

  1. cclaerhout

    cclaerhout Well-Known Member

    I'm not sure this topic should be in the bug, questions forums or here, but when some html (& css & js) are inserted using the XenForo xfInsert function which is wrapped inside the external loader some elements which should be hidden (their css are for example: display: none) are still displayed.

    Example:
    Code:
    	$templateHtml = $(ajaxData.templateHtml);
    
    	new XenForo.ExtLoader(ajaxData, function()
            {
    		$templateHtml.xfInsert('replaceAll', self.trigger, 'xfFadeIn');
    	});
    
    Here's a workaround but I don't understand this behaviour:
    Code:
    	$templateHtml = $(ajaxData.templateHtml);
               
    	$hideThis = $templateHtml.filter(function( index ) {
    		if(this.style) {
    			return $(this).css('display') == 'none';
    		}
    	})
    
    	new XenForo.ExtLoader(ajaxData, function()
            {
    		$templateHtml.xfInsert('replaceAll', self.trigger, 'xfFadeIn');
    		$hideThis.hide();
    	});
    
     
  2. HeadHodge

    HeadHodge Member

    Hi,

    Thanks for helping me out earlier.

    I'm using ExtLoader in my jscript so that I can use xfInsert. Do you happen to know what ExtLoader does and why it's needed??

    Thanks.
     
  3. cclaerhout

    cclaerhout Well-Known Member

    To load required elements in templates: js & css (using ajax). See this bug report for example.
     

Share This Page