WP7 WebBrowser's transparent background (workaround) - windows-phone-7

It's not possible to set transparent background for WebBrowser of WP7. To make impression of transparent background I want to do the following workaround. I want:
To find a position and size of WebBrowser on the page.
To get page's background image.
Crop it with values what I found on step 1.
To save result in IsolatedStorage
To parse HTML and place <body background="RESULTBACKGROUND">
MyWebBrowser.NavigateToString(NewHtmlString);
I think this should be a workaround of transparent background and should work.
For now I am trying just to place any .jpg image (let's say test.jpg) on step 5.
But fail. I have "Build Action" property of file set to "Content". It is placed in the root of the project. And <body background="test.jpg"> not working. Back of the WebBrowser is still white.
What I am doing wrong?
UPD:
Step 5 is solved.
2Claus: No! Not only from web. I saved both html file and image file to IsolatedStorage and WebBrowser can show image as a backgroud.
Now the problem is that background cannot be fixed. I tried many differrent things with styles. I also tried to add a fixed div behind my text. Nothing works. The picture is always scrolling with a text. I tried to add onscroll event and pass it scrolled value to move the div in an opposite direction, but div is glued to the page :(
Any ideas?

So assuming you're talking about the WebBrowser control, you're forgetting that the HTML only can refer to urls on the world wide web.
So either you need to host your background images on a website, or you need to inject a CSS style that sets the background to either white or black (the two default background-colours of the platform).

For WebBrowser, You don't actually have to save it to the ISO to make changes on the page. You can load it navigate to it normally, and then use InvokeScript to make the changes via custom JS code. It can be a little tricky though, as you will probably need to heavily rely on the eval and stringization. The problem mentioned by Claus is still there - but you need to do some experiments. With the Mango release and SDK 7.1+, the platform support IsoltatedStorage imagesources in the form of is://path/file - maybe - maybe - maybe squared - the webbrowser's renderer udnerstands them too - then setting your bkg's url to such would work. I doubt though, as it could be seen as some minor security breach, etc

I now bumped into the same background fixed image problem. For someone wandering here I solved it placing content into a fixed-height container (div) therefore the container contents is being scrolled and not the html page, leaving background picture "fixed".
body
{
background-image:url('...');
background-position:-20px -150px;
background-repeat:no-repeat;
background-attachment:fixed;
}
div
{
height:300px;
overflow:scroll;
}
Of course background-position and div height is set specifically for a WebBrowser position in page and it's size.

Related

Change background color of transparent PNG images uploaded to blogger

I have a blog hosted by Blogger with a custom template: http://www.drugchannels.net/
Images uploaded to the blog are hosted at X.bp.blogspot.com (where X is a number). Examples:
https://1.bp.blogspot.com/-Jwy2VQYRIEA/WqmwvsA07WI/AAAAAAAATA4/jWVcEts1h1Y4IXM0hD0njUhSmQ2AZPnxQCLcBGAs/s1600/Specialty_vs_Retail-2014_vs_2017.png
https://4.bp.blogspot.com/-O4S9ps4u67k/Wk0yhTEuV-I/AAAAAAAASUE/5tPedr-p7_4kedNYU4RY711l6K3maokiQCLcBGAs/s1600/DCI-Copay_Accumulator-03Jan2018-CORRECTED.png
I want to have a white background when the image is clicked. (The images look fine on the site itself. This is not a problem with the blog's background, which is set to be solid white.)
Using the Inspect option in Chrome, I see the following information
The body formatting (background: #0e0e0e;) does NOT appear anywhere on my blog or in my template.
How can I fix?
Thank you!
P.S. I have 10 years of legacy posts with images, so I need a global solution that changes the background to white for all images posted to the blog.
Wrap the image in a div and set the background color of that div with css. That should work
.divclass:active {
background:#FFFFFF
}
If you are opening the images in a new tab or window then your only option is changing the background of the images yourself with a photo editor. If you're just trying to give the user a full size view of an image when they click it you could use javascript/jquery and have a full size div with a background and an image pop up in full screen without sending them to the linked image. Theres probably quite a few jquery plugins that will do this with minimal coding knowledge, just google it.
Thanks, Riley.
I can't go back and edit hundreds of images, so the photo editor option won't work.
But based on your suggestion, I used the following solution:
1) Enabled "Showcase Images with Lightbox" on blogger
2) Added CSS from this page (http://www.howbloggerz.com/2016/05/how-to-customize-blogger-lightbox.html) with no background image and background color set ot white (#ffffff).
Downside is that charts/images now pop up on same page rather than opening in a new tab.
Thank you!

Foundation 5 Data-Interchange background images

I already have data-interchange images on the page - they work fine.
Now that I want to put a background image in a 'div' - I can't get it to work.
What actually happens the image will not show until I put some content in the div. And, of course it only shows enough image to cover the block element in front of it.
I'm guessing I have to some custom CSS to fix this. I actually want the div to be content free, but just show the background image/s based on screen size via data-interchange.
Can anyone help please.
a little vague but from what you have said. have you tried adding the class
.clearfix
on the div with your image in.

Chrome resizes svg images

I have an img menu with svg images that changes the svg image with a identical image with a different color when you push in menu. When I test it with Chrome it works fine until you visit one link the second time, that chrome resize it to a smaller image.
I've made a lot of tests... I've tested :visited css, user agent css, and many another properties and it seems to be all ok. When you changes some css property in developer tools it changes automagically to correct size.
My last test was to change the width from 135px to 134px (don't ask why) and it works in 1680x1050 screen but not in 1920x1200 screen (???????). Is it an aspect ratio problem?
I'm getting crazy!!
I'm using angularjs to make the black image to red image change, but I think this is not the problem (it does a src replacement)
You can see it in the webpage http://silviaperezcruz.com.
I'll apreciate any kind of help.
PD: Sorry for my bad english
I couldn't see an obvious reason why it is doing it,. But if I had to guess, I would cast a suspicious eye on respond.js first. Does it still do it if you remove that?

Full page background image with scroll inside of the div

I am looking to make a "10 foot" useable site for TV. Ideally it would have a full screen background image a small header where the nav will be placed and under it a container for the content. I would like for the container itself to have a scroll bar, as oppose to the browser having the scroll bar, since this would lose my top header.
Basically top header should be fixed, an image for a background, and a container that scrolls inside itself. I have tried finding templates or a starting point online for this with very poor results. The best i have found so far is http://css-tricks.com/examples/FullPageBackgroundImage/progressive.php
This is almost what I need except the container overflows the screen so the scroll bar is in the browser. Also this article was written in 2010, maybe there is a better way to achieve this now?
You can use CSS to style the div.
div.scroll {
background-color:#00FFFF;
width:100px;
height:100px;
overflow-y:scroll;
}
Then... all you have to do is position that div as you want.

z-index not working with images

I am trying to make it so these images will line up the way so that the blank.gif will appear in front of the image. i cannot use it as a background image, and i have tried using a negative z-index like -1 but then the image disappears all together on the site i have tried to use it on. my goal is to make the gray and black image appears behind the blank.gif.
things that i have to avoid or will not work are these:
z-index:-1 (just the negative numbers)
use of background image inside of a <div>
and both the images must remain inside a parent element, and my issue is that i cant use any script that needs to be inside of the head of the html. i have tried but cant find a solution. if you have any method of keeping an image from being right clicked and saved so easily then that would be great. any help is appreciated thank you.
image html are here: index.html
code sample:
<html><div style="position:absolute;width:150px;height:150px;display:inline;">
<img src="http://dl.dropbox.com/u/14413762/blank.gif" style="position:static:width:150px;height:150px;left:0px;top:0px;z-index:2;"><img src="http://dl.dropbox.com/u/14413762/bbc/image.png" style="position:absolute;left:0px;top:0px;;z-index:1;">
</div></html>
Yeah.. You're pretty much wasting time that is better spent elsewhere. A person who wants the image is going to get it, either with the web developer tools in firefox or chrome, viewing the page source, etc.
On a real note though, z-index only works with absolute, relative, or fixed positioned elements. It will not work with your statically positioned element that you set to a z-index of 2. I have done what you are trying to acheive with relatively positioned elements, z-index, and either top and left or negative top and left margins.

Resources