inchasee

i want to put a "x" on the right corner of the floater

11 posts in this topic

Hi there.

Thank so much for using our extension.

but i only can't give you an advice.

BT Floater is simple plugin, all html, js and css are defined in /helpers/helper.php find

Example

echo $content = "<div id='floater_content_".$dir."' style='display:none'>".str_replace("\n","",JModuleHelper::renderModule($module_content))."</div>";

You can add x close button here

echo $content = "<div id='floater_content_".$dir."' style='display:none'>".str_replace("\n","",JModuleHelper::renderModule($module_content))."<a href='#' class='bt-floater-close'>X</a></div>";

You can add css by change this line

$css = "#floater_".$dir."{position: absolute;z-index: 10000;".$dir.":".$x."px;top:".$y."px;}";

or add this line

$css .= ".bt-floater{color: #ffffff; background: #000000;}";

(this css is sample)

Or you can add original CSS to your template css file

.bt-floater-close{color: #ffffff; background: #000000;}

then add this code to your template js file (if you use JQuery)

jQuery(document).ready(function(){

jQuery('.bt-floater-close').click(function(){

jQuery(this).parent().hide();

})

})

Good luck to you

Dmitry likes this

Share this post


Link to post
Share on other sites

Hi Bowthemes-Team,

first thanks you very much for this great extention.

I also want to have an X to close the banner. I did what you adviced, but it does not work. Do you know why?

Here is the code for helper.php

<?php

/**

* @package mod_bt_floater - BT Floater Module

* @version 1.0

* @created April 2012

* @author BowThemes

* @email support@bowthems.com

* @website http://bowthemes.com

* @support Forum - http://bowthemes.com/forum/

* @copyright Copyright © 2011 Bowthemes. All rights reserved.

* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL

*

*/

// no direct access

defined('_JEXEC') or die('Restricted access');

class modBtFloaterHelper {

function fetchHead($params){

$db = JFactory::getDBO();

JHTML::_('behavior.framework');

$document = JFactory::getDocument();

$header = $document->getHeadData();

$mainframe = JFactory::getApplication();

$template = $mainframe->getTemplate();

$y = $params->get('y','150');

$x = $params->get('x','0');

$dir = $params->get('left_right','right');

$module_id = $params->get('module','');

$db->setQuery("SELECT title, module FROM #__modules WHERE id=".$module_id);

$results = $db->loadObjectList();

$btmodule = $results[0];

$module_content = JModuleHelper::getModule($btmodule->module,$btmodule->title);

echo $content = "<div id='floater_content_".$dir."' style='display:none'>".str_replace("\n","",JModuleHelper::renderModule($module_content))."<a href='#' class='bt-floater-close'>X</a></div>";

$document->addScript(JURI::root().'modules/mod_bt_floater/tmpl/js/default.js');

$js = "window.addEvent('load', function() {

createFloating('".$dir."');

window.addEvent('scroll', function(event) {

moveFollow".$dir."(".$x.",".$y.");

});

});";

$css = "#floater_".$dir."{position: absolute;z-index: 10000;".$dir.":".$x."px;top:".$y."px;}";

$css .= ".bt-floater{color: #ffffff; background: #000000;}";

$document->addScriptDeclaration($js);

$document->addStyleDeclaration($css);

}

}

?>

As you mentioned I add this code to my template js file

$.onMediaQuery('(max-width: 767px)', {

valid: function() {

var header = $('#header-responsive');

if (!header.length) {

header = $('<div id="header-responsive"/>').prependTo('#header');

$('#logo').clone().removeAttr('id').addClass('logo').appendTo(header);

$('.searchbox').first().clone().removeAttr('id').appendTo(header);

$('#menu').responsiveMenu().next().addClass('menu-responsive').appendTo(header);

}

}

});

})(jQuery);

jQuery(document).ready(function(){

jQuery('.bt-floater-close').click(function(){

jQuery(this).parent().hide();

})

})

Can you help me?

Thx a lot

Share this post


Link to post
Share on other sites

Hi Huu.

I checked your site. There are some strange script on your page.

Please see this image

http://prntscr.com/6nlaz5

I guess these script is generate by other script because i don't see it in page source.

But i can't find out original code, do you know them or what module use these script?

And really reason of problem is Jquery 1.3.2 is loaded. That is a very old version, it has error.

So i guess that it is culprit of problem

Share this post


Link to post
Share on other sites

Hi tronghm,

thx a lot. But I m a beginner and dont know what is it about. If you want I can text you me access data in backend. Can you take a look on that?

BR

Thien

Share this post


Link to post
Share on other sites

Hi Huu.

I fixed it with other code and it work correctly.

First, in file /mod_bt_floater/helper/helper.php

I change "<a href='#' class='bt-floater-close'>X</a></div>";

to

"<a href='#' class='bt-floater-close' onclick='closeFloater(this)'>X</a></div>";

then i add this function

function closeFloater(anchor){

jQuery(anchor).parent().hide();

}

to file /mod_bt_floater/tmpl/js/default.js

Now it work.

;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now