View Full Version : Resolved Need help...
shsunnyday
06-14-2012, 01:45 PM
Hi. I have a project that I am working on and do not know how to go about doing it. I am hoping someone here can help. :) This may sound simple to some but this is WAY over my head. If anyone would be willing to help me I would be greatly appreciative.
:
What I am trying to do: they say a pic is worth a thousand words so here is a png of what I want my finished item to look like.... https://picasaweb.google.com/lh/photo/jnjtJhUaPtaCkOCFAv4jJ9sA3MZ8o8BEstgTVbE0ruE?feat=directlink (I have also included a couple of pics on this post showing the background change.) This is not a full page item. It will take about the same size as the picture. There are three key items in the project. Background (cycling), Weather, and a random did you know? Let me describe what I want each to do…
1. The background: every time the page is refreshed the image will be a different scene.
2. Weather: I have a script which will already make this happened. However I want it placed and formatted as in my picture.
3. Did you know? This is another (div?) with a border around it like the weather block. Every time the page is refreshed a new text will cycle through.
I want to do this in HTML5 and CSS3. I hope I am describing clear enough of what I am trying to do. If you have any questions please ask! :) If anyone would be willing to help me I would be greatly appreciative. Thank you!!
bernie1227
06-14-2012, 09:24 PM
Hi. I have a project that I am working on and do not know how to go about doing it. I am hoping someone here can help. :) This may sound simple to some but this is WAY over my head. If anyone would be willing to help me I would be greatly appreciative.
:*
What I am trying to do: they say *a pic is worth a thousand words so here is a png of what I want my finished item to look like.... https://picasaweb.google.com/lh/photo/jnjtJhUaPtaCkOCFAv4jJ9sA3MZ8o8BEstgTVbE0ruE?feat=directlink (I have also included a couple of pics on this post showing the background change.) *This is not a full page item. It will take about the same size as the picture. There are three key items in the project. Background (cycling), Weather, and a random did you know? Let me describe what I want each to do…
1. The background: every time the page is refreshed the image will be a different scene.
2. Weather: I have a script which will already make this happened. However I want it placed and formatted as in my picture.
3. Did you know? This is another (div?) with a border around it like the weather block. Every time the page is refreshed a new text will cycle through.
I want to do this in HTML5 and CSS3. I hope I am describing clear enough of what I am trying to do. If you have any questions please ask! :) *If anyone would be willing to help me I would be greatly appreciative. Thank you!!
Ok, so this is basically fairly simple stuff.
1. If you want this done the simplest way possible, you'll want to use JavaScript. *
Here's some example code for it.
<html>
<head>
<style>
body
{
/*Remove below line to make bgimage NOT fixed*/
background-attachment:fixed;
background-repeat: no-repeat;
/*Use center center in place of 300 200 to center bg image*/
background-position: 300 200;
}
</style>
<script language="JavaScript1.2">
/* you must supply your own images */
var bgimages=new Array()
bgimages[0]="http://js-examples.com/images/blue_ball0.gif"
bgimages[1]="http://js-examples.com/images/red_ball0.gif"
bgimages[2]="http://js-examples.com/images/green_ball0.gif"
//preload images
var pathToImg=new Array()
for (i=0;i<bgimages.length;i++)
{
* pathToImg[i]=new Image()
* pathToImg[i].src=bgimages[i]
}
var inc=-1
function bgSlide()
{
* if (inc<bgimages.length-1)
* * inc++
* else
* * inc=0
* document.body.background=pathToImg[inc].src
}
if (document.all||document.getElementById)
* window.onload=new Function('setInterval("bgSlide()",3000)')
</script>
</head>
<body>
<BR><center><a href='http://www.js-examples.com'>JS-Examples.com</a></center>*
</body>
</html>
2. * Fairly simple, itd end up with the same kind of styling as number 3, so a background color as gray, then you have the image, with a padding-left of roughly * 20px, and then have a button with a background color of white and text color black and this should all have the appropriate heights and widths that you want. and then just put your code for getting the weather next to it.
3. Depending on whether you only to scroll once when you open the page or continuously, the code would be something along the lines of:
Only when the page refreshes:
<div id="container">
<h1 style="color: black;">Did you know?</h1>
<div id="SlidingText">
<marquee behavior="slide" direction="left">Your slide-in text goes here</marquee>
</div>
<button style="background-color: blue; color: white;" id="findout">Learn About Lincoln</button>
</div>
CSS:
#SlidingText {
background-color: white;
height: 100px;
width: 200px;
margin: 100px;
}
#container {
background-color: gray;
height: 200px;
length: 300px;
}
and then you basically do excactly the same thing for continuously scrolling except change:*
<marquee behavior="slide" direction="left">Your slide-</marquee>
to:
<marquee behavior="scroll" direction="left">Your slide-
</marquee>
shsunnyday
06-15-2012, 03:35 AM
whs
http://www.aldg.info/xiaowang1.jpg
http://www.aldg.info/xiaowang2.jpg
http://www.aldg.info/xiaowang3.jpg
The pics are not showing up..
keyboard
06-15-2012, 03:37 AM
@shsunnyday
They're not meant to. It's a spam bot that's spamming the forum. (The images link back to the spamists site {or at least probably do})
When one of the mods is next on, they'll remove all their posts and ban them from the forum.
shsunnyday
06-15-2012, 03:40 AM
@bernie1227 Thank you for your in-depth help! I am working on it and will let you know how I come. Still need to put the weather script in as well as the randomize part... Still not done yet, but have got the layout all made. It is looking nice.
shsunnyday
06-15-2012, 03:42 AM
ok. to bad people try to do such things as clutter up useful websites.
keyboard
06-15-2012, 03:44 AM
Yes, it's mainly because when there is a link to a site (what they posted) google (and other SEs) ranks the linked website higher. This is called an SEO boost (at least that's what I call it :D)
bernie1227
06-15-2012, 04:20 AM
Back on topic, if you need any more help, ask me
shsunnyday
06-15-2012, 07:57 PM
Back on topic, if you need any more help, ask me
I got it completely built and put in the random background, text and weather, all that works well. However... when I try putting it into my page the entire think is messed up.
1. Directly put code into page: the gray area around the weather and do you know do not show up! (see pic: https://picasaweb.google.com/lh/photo/7YilPULacDz78LHayNZZ4tsA3MZ8o8BEstgTVbE0ruE?feat=directlink)
2. iframe: from this picture (https://picasaweb.google.com/lh/photo/E4yOc1LOzIwRBTQD4pg3wdsA3MZ8o8BEstgTVbE0ruE?feat=directlink) you can see that the gray shows up but the entire thing does not completely show.
3. php include: (https://picasaweb.google.com/lh/photo/SLLvSu_8OvhHkfcNScKMWNsA3MZ8o8BEstgTVbE0ruE?feat=directlink) Also problems. The gray does not show and the entire thing is covering content which should be below it. not underneath.
what is the best thing to do?
Thanks! :)
bernie1227
06-16-2012, 12:13 AM
I got it completely built and put in the random background, text and weather, all that works well. However... when I try putting it into my page the entire think is messed up.
1. Directly put code into page: the gray area around the weather and do you know do not show up! (see pic: https://picasaweb.google.com/lh/photo/7YilPULacDz78LHayNZZ4tsA3MZ8o8BEstgTVbE0ruE?feat=directlink)
2. iframe: from this picture (https://picasaweb.google.com/lh/photo/E4yOc1LOzIwRBTQD4pg3wdsA3MZ8o8BEstgTVbE0ruE?feat=directlink) you can see that the gray shows up but the entire thing does not completely show.
3. php include: (https://picasaweb.google.com/lh/photo/SLLvSu_8OvhHkfcNScKMWNsA3MZ8o8BEstgTVbE0ruE?feat=directlink) Also problems. The gray does not show and the entire thing is covering content which should be below it. not underneath.
what is the best thing to do?
Thanks! :)
Ok, shsunnyday, I think I can see most of your problems.
1. Find the divs surrounding the two parts, and set the background color on them to gray. (please post the code so I can check this)
2. I'll need you to post the code for the Iframe please
3. Sorry abou that, I think that may have been my fault, the problem is that the text is to big for the button. I suggest you make the height of the button bigger.
Please post the code for the iframe and the first question!
Thanks
Bernie
shsunnyday
06-17-2012, 03:55 AM
sorry for the delay. here is the code, it looks good standalone on its own page but like I said when I try including it (many methods) into another page is gets messed up.
<?php
$bg = array('background.png', 'background2.png', 'background3.png',
'background4.png', 'background5.png','background6.png','background7.png',
'background8.png', 'background9.png', 'background10.png'
); // array of filenames
$i = rand(0, count($bg)-1); // generate random number size of the array
$selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen
?>
<head>
<?php
include_once('phpweatherlib.php');
$displayWeather=true;
//CREATE OUR WEATHERLIB OBJECT FOR NEW YORK CITY (WEATHER STATION KNYC)
$weatherLib=new WeatherLib('KLNK');
if($weatherLib->has_error())
{
echo "ERROR: ".$weatherLib->get_error();
$displayWeather=false;
}
?>
<?php if($displayWeather==true){ ?>
<!--Random Content-->
<?php
include("script/randomcontent.html");
?>
<!--end random content-->
</head>
<style type="text/css">
#background
{
width: 766px;
height: 347px;
background: url(img/home/<?php echo $selectedBg; ?>) no-repeat;
border:0px solid black;
position: absolute;
z-index: 1
}
#weather
{
position: absolute;
z-index: 550;
background-color: bababa;
width: 240px;
height: 150px;
margin-left: 45px;
margin-top: 30px;
opacity: 0.80;
}
#weather:hover
{
opacity: 0.80;
}
#current-image
{
margin-top: 15px;
margin-left: 30px;
}
#current-image:hover
{
opacity: 0.8;
}
#details
{
background: url(img/button.jpg) no-repeat;
margin-left: 30px;
margin-top: 5px;
position: absolute;
z-index: 510;
height: 30px;
width: 69px;
}
#details:hover
{
opacity:0.8;
}
#Detailstext
{
font-weight: bold;
font-size: smaller;
font-family: "arial";
color: white;
margin-top: -10px;
margin-left: 10px;
position: absolute;
z-index: 550;
}
#Currents
{
margin-left: 120px;
margin-top: 0px;
position: absolute;
z-index: 510;
height: 30px;
width: 69px;
}
#currents:hover
{
color: black;
font-wight: bolder;
}
#Text {
background-color: white;
height: 60px;
width: 80%;
margin: 30px;
margin-top: 0px;
position: absolute;
z-index: 500;
padding: 10px;
}
#didyouknow_container {
background-color: bababa;
height: 160px;
width: 400px;
position: absolute;
z-index: 500;
margin-left: 330px;
margin-top: 125px;
opacity: 0.8;
}
#didyouheader
{
margin-left: 25px;
font-family: Arial;
margin-top: -15px;
}
#randomcontent
{
font-weight: bold;
}
#button
{
background: url(img/button.jpg);
margin-left: 160px;
margin-top: 90px;
position: absolute;
z-index: 510;
height: 20px;
width: 200px;
}
#button:hover
{
opacity:0.8;
}
#Buttontext
{
font-weight: bold;
font-size: smaller;
font-family: "arial";
color: white;
margin-top: -16px;
margin-left: 20px;
position: absolute;
z-index: 550;
}
</style>
<div id="Home">
<div class="container">
<div id="background">
<!--Background image here-->
</div><!--end background -->
<div id="weather">
<div id="currents">
<strong><h3>
<?php echo $weatherLib->get_temp_f(); ?> F
<br><?php echo $weatherLib->get_weather_string(); ?></br>
</strong></h3>
</div> <!--end Currents -->
<div id="current-image">
<img src="<?php echo $weatherLib->get_icon(); ?>" width="69" height="74" alt="current weather" >
</div> <!--end Current Image -->
<a href="Weather.php" >
<div id="details">
<div id="Detailstext">
<span><h3>Details</h3></span>
</div><!--end Details text -->
</div><!--End details-->
</a>
\ <?php } //END IF ?> <!--end weather php script-->
</div><!--end Weather-->
<div id="didyouknow">
<div id="didyouknow_container">
<div id="didyouheader">
<h3>Did you Know?</h3>
</div><!--end Did you know header-->
<div id="Text">
<div id="randomcontent">
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincon is home to the first 911 system. </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln is home to the Nebraska Cornhuskers</p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln is home to the nation's only Unicameral</p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">UNL is home to the United States largest weight room. It is 3/4 of an acre. </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln was not always the Capitol city of Nebraska. </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln is ranked number 2 in the nation for the happiest people (Gallup). </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln is ranked 4th Best Place to Raise a Family (Children's Health, 2009) </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Lincoln is ranked 5th Safest American City (<a href="http://realestate.yahoo.com/promo/americas-safest-cities-2011.html" target="_blank"> Forbes</a>, 2011) </p>
</div>
<div class="randomcontent group2">
<p style="margin-top: -5; ">Charles Lindbergh learned to fly in Lincoln. He took lessons at Lincoln Airplane and Flying School where Lincoln Memorial Park is today. </p>
</div>
<script type="text/javascript">
//Call this following all random contents HTML on the page:
randomcontentdisplay.init()
</script>
</div><!--end randomcontent-->
</div><!-- end Random Did you know text-->
<a href="about.php" >
<div id="button">
<div id="buttontext">
<span><h3>Learn About Lincoln</h3></span>
</div><!--end Learn about lincoln button text-->
</div><!--end Learn about lincoln button image--></a>
</div><!--end didyouknow_container-->
</div><!--end didyouknow-->
</div><!--end home container-->
bernie1227
06-17-2012, 04:03 AM
Thanks for the code shsunnyday, could you possibly remind me what the problems were? :P
thanks,
Bernie
shsunnyday
06-17-2012, 04:10 AM
Thanks for the code shsunnyday, could you possibly remind me what the problems were? :P
thanks,
Bernie
yep the problems were with displaying correctly when including onto another page via iframe, direct inert, or php include. each showed a separate problem. take a look at the screenshots in my above post. thanks for your continued help.:)
bernie1227
06-17-2012, 04:18 AM
Ummm....... I see one quite major problem.... The CSS code isn't actually in the head of the page, so none of it is being implemented.
Bernie
shsunnyday
06-17-2012, 04:34 AM
You are right. The CSS should be in the head. My browser was reading it anyway and dysplaying it exactly how I wanted when this code was opened by itself. When including it onto another page (where I need it) I run into the problems. Did you see anything else that maybe causing the issues?
bernie1227
06-17-2012, 04:50 AM
You are right. The CSS should be in the head. My browser was reading it anyway and dysplaying it exactly how I wanted when this code was opened by itself. When including it onto another page (where I need it) I run into the problems. Did you see anything else that maybe causing the issues?
I think I've found a couple of minor problems,
1. You are choosing the colors with hex-codes, So I think you had in there:
Background-color: bababa;
However, hex codes need to have a # in front of them, so it should be:
Background-color: #bababa;
Also, the actuall text is to big for the button, so you need to change the buttons height in the CSS.
shsunnyday
06-17-2012, 04:55 AM
Thanks. I will make those changes. I wonder if the button image size could be what's throwing everything off? Or maybe it's a div/CSS that is conflicting on the page I am inserting this code into?
bernie1227
06-17-2012, 05:00 AM
Hmmm... Could be, tell me what the problems are when you've done those things
shsunnyday
06-17-2012, 09:00 PM
Hmmm... Could be, tell me what the problems are when you've done those things
After making those changes I tried inserting again. Finnally I was able to make an iframe do what I wanted. It now is in my page exactly where I need it and it looks how it should. Idk, why but I still did not get results by inserting via php include or directly in the page. I am thinking another css element on the page may be blocking the functions. Here is the script for my iframe.
<div id="iframe">
<iframe src="file.php" width="800px" height="360px" scrolling="no" frameborder="0" > This feature is not compatible with either your
browser.</iframe>
</div>
Thank you very much for your help bernie1227!
shsunnyday
06-17-2012, 09:16 PM
I spoke to quickly. Because I had to do it in an iframe to make it work the link then open up within that frame rather than on the entire page! Since i can not target mainframe with this, maybe iframe is not a solution after all.
ApacheTech
06-17-2012, 09:16 PM
One thing for Cross Browser Compatibility, although I'm sure it won't a difference here; as a rule of thumb, you should try and refrain from naming your elements with actual tag names. It can cause easily mistaken coding errors and stuff. I've spoken on here before about the Hungarian Naming Method, where you prefix your variables and elements with the type, so your <div id="iframe"> would be <div id="divIframe">.
It's a good habit to get into, mainly because it's easier to see what everything is at a glance, but also, there's no chance of anything mistaking that div for an actual <iframe> tag elsewhere in the code. It's unlikely, but it could happen.
The full Hungarian Method is far too long-winded to be useful in Web Development, but you can use a watered down version to great effect.
$strHelloWorld = 'Hello World!';
$intAge = 28;
$aryPeople = array( "John", "Paul", "Ringo", "George" );
bernie1227
06-17-2012, 09:18 PM
Thanks apache,
Shsunnyday, so what are you actually trying to do?
Bernie
shsunnyday
06-17-2012, 09:50 PM
good tip, Apache thanks.
@bernie I am sorry for not explaining better. This is to go on my homepage (index). I have attached an image to this post showing the layout. I have a content slider showing featured content then a link ad unit and below that will be this item. Hope that helps.
I want this to be included seamlessly into my page. Each time I try (using several inclusion methods) something goes wrong.
bernie1227
06-18-2012, 08:54 PM
Hi shsunnyday, sorry for the late reply, could you please tell me the exact problems? My thoughts are that there may be conflicting CSS rules with the iframe.
shsunnyday
06-22-2012, 01:15 AM
Hi shsunnyday, sorry for the late reply, could you please tell me the exact problems? My thoughts are that there may be conflicting CSS rules with the iframe.
Sorry for the late reply. I certainly appreciate your continued help!
My problem was:
1. when clicking on any of the buttons within the iframe the new page loaded within the frame. I did not want this. I wanted the entire page to load in the parent.
I fixed this using a target="_top" in the links. I do not know why but it did not work the first time I tried it. Anyway it is good now!
Thank you for your help! :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.