Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

[SOLVED] Custom Javascript/jQuery Popup not working in Atahualpa.


 
Prev Previous Post   Next Post Next
  #1  
Old Jan 29, 2011, 06:18 PM
Factorfiction's Avatar
Factorfiction
 
24 posts · Jan 2011
Options [SOLVED] Custom Javascript/jQuery Popup not working in Atahualpa.

Hello.

I have played around in Dreamweaver for a while now and came up with a nice design for a custom menu bar.

I also have used this example to make a popup for one of the menu items.

The following code works like a charm in chrome, firefox and internet explorer.
But after trying importing the code to Atahualpa, the popup DIV-tag dosen't show up.

HTML Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

a.underbar-tag0 {
	display: block;
	width: 90px;
	height: 32px;
	float: left;
	color:#000;
	background-image: url(../../Root/buy_blue.png);
        background-repeat: no-repeat;
	background-position: 0px 0px;
	margin-right: 0px;
	padding-top: 9px;
	padding-left: 40px;
	font-size: 16px;
	font-family: Arial, Helvetica, sans-serif;
	margin-left: 80px;
	font-weight: bold;
}
a.underbar-tag0:hover {
	color:#9C0;
	background-image: url(../../Root/buy_blue.png);
	background-repeat: no-repeat;
	background-position: 0px -45px;
}
a.underbar-tag1 {
	display: block;
	width: 114px;
	height: 32px;
	float: left;
	color:#000;
	background-image: url(../../Root/benefits_blue.png);
	background-repeat: no-repeat;
	background-position: 0px 0px;
	margin-right: 40px;
	padding-top: 9px;
	padding-left: 78px;
	font-size: 16px;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	margin-left: 60px;
}
a.underbar-tag1:hover {
	color:#FFF;
	background-image: url(../../Root/benefits_blue.png);
	background-repeat: no-repeat;
	background-position: 0px -45px;
}	
a.underbar-tag2 {
	display: block;
	width: 122px;
	height: 32px;
	float: left;
	color:#000;
	background-image: url(../../Root/help_blue.png);
	background-repeat: no-repeat;
	background-position: 0px 0px;
	margin-right: 40px;
	padding-top: 9px;
	padding-left: 70px;
	font-size: 16px;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	margin-left: 40px;
}
a.underbar-tag2:hover {
	color:#FFF;
	background-image: url(../../Root/help_blue.png);
	background-repeat: no-repeat;
	background-position: 0px -45px;
}	
a.underbar-tag3 {
	display: block;
	width: 120px;
	height: 32px;
	float: left;
	color:#000;
	background-image: url(../../Root/kostnad_blue.png);
	background-repeat: no-repeat;
	background-position: 0px 0px;
	margin-right: 40px;
	padding-top: 9px;
	padding-left: 72px;
	font-size: 16px;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	margin-left: 40px;
}
a.underbar-tag3:hover {
	color:#FFF;
	background-image: url(../../Root/kostnad_blue.png);
	background-repeat: no-repeat;
	background-position: 0px -45px;
}	
.popup {
	position: absolute;
	display: none;
	z-index: 50;
	border-collapse: collapse;
	background-image: url(../../Root/recommended.png);
        height: 191px;
	width: 150px;
	background-repeat: no-repeat;
	background-position: 0px 0px;
	float: left;
}
	
</style>

<script src="jquery.js" type="text/javascript"></script>

<script type="text/javascript">
    <!--

    $(function () {
        $('.underbar').each(function () {
            var distance = 10;
            var time = 250;
            var hideDelay = 500;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('.underbar-tag0', this);
            var info = $('.popup', this).css('opacity', 0);


            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;

                    info.css({
                        top: 20,
                        left: 0,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });
    });
    
    //-->
</script>

</head>

<body>

<div class="bg"></div>

<div class="underbar">

  <div>
  <a href="" class="underbar-tag0">Köp nu</a>
  </div>
    
  <table id="dpop" class="popup"></table>
    
  <a href="" class="underbar-tag1">Fördelar</a>
  
  <a href="" class="underbar-tag2">Nybörjare?</a>
  
  <a href="" class="underbar-tag3">Kostnad</a>
  
</div>

</body>

</html>
I imported CSS via ATO --> Add HTML/CSS Inserts --> CSS Inserts which worked.
I imported the HTML code via Editor --> bfa_header_config.php and dumped the code after "$horizontal_bar1 =", which also worked.
But then I tried to add the javascript under ATO --> Add HTML/CSS --> HTML Inserts: Header but it did not seem to work.

Everything is set and look exactly as it should, but when I hover underbar-tag0, there is no animation.

Am I doing something wrong?

Link to my website: http://e-cigaretter.nu/

Last edited by Factorfiction; Jan 29, 2011 at 06:54 PM.
 

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] javascript in widget not working Emanuele Sidebars & Widgets 12 May 24, 2010 03:14 PM
How to include javascript in header for custom posts? crixan Header configuration & styling 0 May 19, 2010 03:54 PM
[SOLVED] Javascript not working in widget sidebar marj318 Sidebars & Widgets 4 Apr 30, 2010 05:59 AM
WP Menu Manager javascript not working? devarah Plugins & Atahualpa 1 Feb 7, 2010 05:37 PM
How to add custom upper menu using javascript bkaushik Forum How-To 0 Feb 4, 2010 09:17 PM


All times are GMT -6. The time now is 12:42 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.