Good afternoon,
I am seeking some help with a mouse over effect on an image... I have images that are 100x100 I would like to be able to mouse over them and it pull up a window showing that image in a larger format 400x400
I wanted to use this code here - <?php
-
$filein = 'help.html';
-
// ----------------------------------------
-
// Read help file into variable $help_text
-
// ----------------------------------------
-
$help_text = "";
-
if ($fd = fopen ($filein, "r")) {
-
$help_text = fread($fd, filesize ($filein));
-
fclose ($fd);
-
}
-
if ($help_text == '')
-
$help_text = 'No help text available';
-
$help_text=htmlentities($help_text);
-
$help_text=str_replace(array("\n", "\r"), array("",""), $help_text);
-
echo '<a align="right" href="#" onmouseout="javascript:hideTooltip()" onmouseover="javascript:showTooltip(event,\''.$help_text.'\');return false"><img src="http://test.valoriprecast.com/images/ProductImages/Colors/thumbs/Blanco Smooth.jpg" border="0"></a>';
-
?>
As you can see it is JavaScript and PHP. However the site I am working with is .aspx ASP.NET 2.0 via IIS.
I had asked if I could get the PHP to be read with in the .aspx extension and I got replies along the lines of why use three different codes? Thinking about it now that makes sense but the reason I was trying to do that is because I know how to use PHP...
Is there anyway anyone could tell me how to do a mouse over effect in ASP? Or maybe how I could enable PHP to be read?
Thank you,
Chris
16 3777 Frinavale 9,735
Recognized Expert Moderator Expert
You'd still use JavaScript for the to display the larger image during the "onmouseover" event of the image.
You could do one of two things at that point.
You could show an already preloaded image (that is hiding on the page).
Or, you could make a call to an ASPX page that simply returns an image.
Which version are you thinking about using?
Okay to that message you sent me.
As to your answer hmmm which is a better method to use... I do not think having up to 20 plus pictures hiding on the page is a good idea the load time would be to long...
So I would have to say calling on another page is a good idea.
Thank you,
Chris
Frinavale 9,735
Recognized Expert Moderator Expert
Ok, there's this neat technique that is commonly used for displaying thumbnails or dynamic images retrieved from a database... it can actually be used for things other than images but maybe I should explain it first.
You create a new ASPX page in your project, but this page will not return HTML when called by the browser. Instead it will return the image.
In the PageLoad event for this ASPX page you would change the content type that the page returns by setting the Response.ContentType property. You'd load the image, and write the image directly to the Response.Output stream
For example (I'm not sure if you're doing VB or C#...but this is VB code): -
''' <summary>
-
''' This will retrieve a file that resides on the server and write it directly to the output stream.
-
''' The content returned by this aspx page will be the file that was retrieved from the server
-
''' and not regular HTML.
-
''' </summary>
-
''' <param name="sender">The Page that raised the event.</param>
-
''' <param name="e">The EventArgs for the Page Load event.</param>
-
''' <remarks></remarks>
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
Response.ContentType = "image/jpg"
-
Dim fs As FileStream = File.OpenRead(Server.MapPath("~/Images/DogObedienceTraining.jpg"))
-
Dim b(fs.Length) As Byte
-
For i = 0 To fs.Length - 1
-
b(i) = fs.ReadByte
-
Next
-
fs.Close()
-
Response.BinaryWrite(b)
-
End Sub
The above example will grab a specific image from the server and return it to the browser....for this to work you'd have to specify the URL of the ASPX page as the source for the image tag.
For example, say the ASPX page with the above code was named ImageGrabber.aspx. In the page where you want to display the image you would set the Image URL property of an ASP.NET Image control to the URL of the ImageGrabber.aspx page: -
<asp:Image ID="CardHolderImage" runat="server" ImageUrl="~/ImageGrabber.aspx" />
The nice thing about this is you can supply an ID for the Image to display in the URL. The ImageGrabber.aspx page can use this ID to dynamically grab the image that you want to display.
With me so far?
I understand to a fine point... My issue here is that I am not using VB or anything for that matter let me show you... http://test.valoriprecast.com/pg--138--Colors.aspx
There is a backdoor admin page where I can create that pg--138--Corlos.aspx
Then there is a simple frontpage2003 type plug in that I can edit and add stuff into it... Now I can go to the source of the page in that plug in and add custom coding... So I am not actually coding anything in aspx the site is already set up from another company but it is a CMS they made using some shopping cart... I am just making a new site out of the existing code... I’ve changed the CSS to make the custom theme and I am just adding content... I just wanted to get fancy with this page here you can see what I have going on id like to get the image hover thing here as you can see why.
So I kind of follow you but at the same time I am not 100% sure.
We paid the company that did the main working components of the site for another license to use it... I am just populating it now for a new business that we are opening.
Hope that helps see where I am at with this whole thing... So I do not have a VB editor or anything like that.. I been using FrontPage to edit source than copying and pasting it into the plug-in via that page...
Here is a screen shot of the back end of admin side... http://test.valoriprecast.com/Downloads/mo.jpg Frinavale 9,735
Recognized Expert Moderator Expert
This is going to be very hard to work with.
I would look into downloading Visual Studio Express. There are 4 free versions of Visual Studio available, one of them is for web development. I've never used it before but I have a feeling that working in Visual Studio will be a lot easier than using what you currently have.
Once you have your controls working on your development machine, then start looking at uploading them to the server and modifying the existing code to use it.
Please explain your last part, Are you saying once it is install to let you know? I downloaded and installed it... I am not sure what you mean by uploading and modifying existing code... not sure where I would look.
Frinavale 9,735
Recognized Expert Moderator Expert
Now that you've installed Visual Studio it will be easier to create the feature for the mouse over effect. You can also create a test application using Visual Studio that will help you debug the feature before moving it to the server.
Once you're satisfied with this feature you'll move it to the server. At this point you're going to have to modify the existing aspx so that they can use your new feature.
@Frinavale
Where do I start? Like what am I looking for... do I just use that code you provided above... Do I have to do anything in the web.config not sure what file I am opening with VS
Frinavale 9,735
Recognized Expert Moderator Expert
You don't have to do anything with the web.config.
Open a new project....use the Default.aspx page for testing.
Add a new aspx to the project and place the above code in it.
Hmm this doesnt seem easy at all.... I am a little lost in the VB Express... Do I place the code you gave me above in between -
<Page x:Class="Page1"
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-
Title="Page1">
-
<Grid>
-
-
</Grid>
-
</Page>
-
<Grid> ? </Grid>
Frinavale 9,735
Recognized Expert Moderator Expert
The above is WPF stuff...
You should be using the Visual Studio Web Express...
Frinavale 9,735
Recognized Expert Moderator Expert
I think I've found a solution to your problem that doesn't actually use ASP.NET at all.
It's purely JavaScript based.
Take the following code and copy it over your Default.aspx code: -
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head runat="server">
-
<title>Untitled Page</title>
-
-
<script type="text/javascript">
-
function AddMouseoverToImages(){
-
var images = document.getElementsByTagName("img");
-
var numImges = images.length;
-
var i =0;
-
for(i=0; i<numImges; i++){
-
if(images[i].id != "bigImage")
-
{
-
try{
-
images[i].addEventListener('mouseover',DisplayLargeImage,false);
-
}catch(ex){
-
images[i].attachEvent('onmouseover',DisplayLargeImage);
-
}
-
}
-
}
-
-
}
-
function DisplayLargeImage(event){
-
var url;
-
if(event.srcElement==null){
-
url=this.src;
-
}
-
else{
-
url=event.srcElement.src;
-
}
-
var pattern = "/[a-zA-Z0-9_.%20]*$";
-
var regex = new RegExp(pattern);
-
-
var imageName = regex.exec(url);
-
var urlPattern = "/[a-zA-Z0-9_%20]*/[a-zA-Z0-9_.%20]*$";
-
var urlRegex = new RegExp(urlPattern);
-
var newurl = url.replace(urlRegex,imageName);
-
-
var bigImage = document.getElementById("bigImage");
-
bigImage.src = newurl;
-
-
}
-
-
</script>
-
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
-
<script type="text/javascript">
-
window.onload=AddMouseoverToImages;
-
</script>
-
-
<div style="height: 400px; width: 400px; margin: 5px auto;">
-
<img src="/Images/Cabo Smooth.jpg" id="bigImage" alt="large image" />
-
</div>
-
<div style="overflow-x:auto; overflow-y:hidden; overflow: auto; width:150px; height:auto;margin: 0px auto;">
-
<table>
-
<tr>
-
<td>
-
<asp:Image ID="CaboSmooth" runat="server" ImageUrl="~/Images/Thumbs/Cabo Smooth.jpg" />
-
</td>
-
<td>
-
<asp:Image ID="CarbonSmooth" runat="server" ImageUrl="~/Images/Thumbs/Carbon Smooth.jpg" />
-
</td>
-
</tr>
-
</table>
-
</div>
-
</form>
-
</body>
-
</html>
Make sure that you have a Thumbs folder in your Images folder.
Make sure that the thumbnails "Carbon Smooth.jpg" and "Cabo Smooth.jpg" images are in the Thumbs folder....likewise, make sure that the large versions of these are in the Images folder.
After changing the paths for where my images are on the server, I tested it out in VB Web Express and it works just fine... Before adding in any other images I wanted to load it up live on the site and try it out.
Sadly it doesnt seem to be reading the asp part... Not sure why it would do that... but I copied the source as is and placed it in the colors.aspx page... http://test.valoriprecast.com/pg--138--Colors.aspx
That is all it pulls.... any thoughts?
Scratch that.... Instead of using asp to call on the images I switched it to just normal html... Works grate!!! thank you for that. Take a look at that link I am trying some tables to make it look slick.
Frinavale 9,735
Recognized Expert Moderator Expert
:) I like it!
It looks good even without the scrolling stuff we were discussing.
Sure does, I am just trying to tweak it some to look right... than I have to make some little paragraph to explain how it works haha
But thank you for all your time and help I really appreciate that! I know when I said I do AD stuff, you made the comment I might be able to help you.
Just let me know and I will do my best to help you out with whatever the issue may be, I know AD can be a pain if something goes wrong between sites and other things, for the most part it is really slick when it is running smoothly. =]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ids |
last post by:
I have my own website and i want to use a mouse effect.
My problem is that i use frames and when i put the javascript in the index.html like this:
<html>
<head>
<meta name="keywords" content="vacation">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">...
|
by: Anders Eriksson |
last post by:
Hello!
I have a program with three views
------------------------------------
| | |
| 1 | 2 |
| | |
| |--------------------------|
| | |
|
by: Charles Law |
last post by:
Sorry for reposting this question, but I did not get a single answer last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped onto a form in my
application when it is running. I allow it to be clicked and dragged to a
new location on the form. However, the user control has...
|
by: StriderBob |
last post by:
In a simple two form project, use a button on each form to Show() the other
form and Hide() the current form. Add MouseEnter and MouseLeave events to
both buttons so they change the image on each button when they are NOT
Clicked but the cursor enters their boundary.
This setup works fine. If the mouse cursor enters the button on the...
|
by: ML |
last post by:
I am trying to use the mouse wheel event on a numeric input box to allow the
use to scroll to inc/dec the value by 1. The issue I am having is that the
delta value returned seems to be off. From my understanding the delta is
the number of detents the mouse has moved. The standard detent is
supposedly 120 for one notch of the wheel, however...
| |
by: yerk5 |
last post by:
I'm trying to make use of one of those popular scripts you see all over
the web these days, where you mouse over a image or link and you get a
floating preview of something before you click it.
Basically, if you go to www.templatemonster.com and mouse over a
template, that's the exact effect I want. So I viewed their source, and
saw that...
|
by: wmanzo |
last post by:
I have a really professional conspiracy movie site
and I use tons of layers and an external scroll bar assembly.
I would like to put the various sections into MS Iframes and
in order to clean up the page but I find that the iframes interfere
with the getting the mouse coords from the screen which is
essential in moving the scroll bar around....
|
by: james |
last post by:
Hello
I'm implementing drag and drop between two listviews (in detail view mode).
When I drag an item from box a to box b, I then process information relating
to the two items. The item from box a does not need to be added into box b.
What I can't see how to do is for the item under the mouse in box b when I'm
dragging to get...
|
by: Edward |
last post by:
IE6 only displays certain text on my site if you mouse over it (!).
I reduced the HTML down to this code below which still shows this
effect/bug.
My temporary solution was to take out all the comments from my HTML.
I reproduced this effect on two computers which use IE6.
Why will IE6 not show the first line of text below when the page...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |