Affichage des articles dont le libellé est Active questions tagged html - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Active questions tagged html - Stack Overflow. Afficher tous les articles

jeudi 13 août 2015

@Html.LabelFor with an tag inside it

This should be a fairly simple question, all I want to do is use @Html.LabelFor within a razor view. One of my labels is different, it has an <a> tag in it. the problem is when I use LabelFor, it encodes the html as & lt;. I've tried a lot of different approaches to making this happen but none of them are working. Here's the code.

@Html.LabelFor(model => model.Question, new { @for = "Question" })

what should get outputted:

<label for="question"><a href=\"mailto:support@testdomain.com">support@testdomain.com</a></label> ( formatted as a mailto link, stackoverflow just doesn't show it, whether i use code or not)

what does get outputted:

<label for="question"><a href=\"mailto:support@testdomain.com">support@testdomain.com&lt;/a&gt;</label>

(my < have been replaced with & lt ; without the spaces, thus the code shows on the page instead of rendering as a link)

how can I make it output what it should?

note, model.Question is set to <a href="mailto:support@testdomain.com">support@testdomain.com</a>



via Chebli Mohamed

Should I use CSS scaling to accommodate a browser resize on my website?

I see some websites remain static when the browser is resized and some that scale to fit depending on the window size. My question is what's the best to use and how would I implement both a static style or one that would adapt to a browser window resize.

The only information I could find that made it clear was that using max-width: 100%; height: auto; scales certain objects to adapt to a browser window resize. The thing is, it only works for some things not all. Here is my site, as you can see it's a bit of a mess. I would like it all tidied up properly like this site that I believe is static. However if answers can show me a way to make it scalable as well that would be great. But I assume having it static is easier.

Also if it helps here is a fiddle of a page from my site.



via Chebli Mohamed

Add an "click outside of menu to close" jquary/javascript to a menu drop-up that has .toggle()

I would like to add the function to close the menu if i click outside the menu. And also keep the menu button working to close it too: http://ift.tt/1DNxM2R

$(document).ready(function () { $("li").click(function () { $('li > ul').not($(this).children("ul").toggle()).hide(); }); });

Also can you tell me if this is correct for mobile etc? I hope and think so, because it's using .click, right?

This is referring to this post, that I can't reply to the answer to ask there: How to change drop-down menu to drop-up menu



via Chebli Mohamed

How to Put an Image on HTML and Make it Go Across Page?

Some computers have smaller displays, so, how do I put an image that will resize to go across the whole page? This is for a banner. Also, if it does resize, won't the quality change?



via Chebli Mohamed

ng-show, toggle right element on click [Angularjs]

I wana toggle elements but not all elements i need just one on which is clicked.

for example if I have 3 form elements and 3 buttons if I click on button 1. I just wana toggle 1. form element.

This is my current code:

angular:

$scope.formWhat = false;
$scope.formShow = function(item){
                   $scope.formWhat = !$scope.formWhat;
               };

html:

<div ng-repeat="x in comments">
<a href="#" ng-click="formShow(x)">replay</a>
       <form id="<%x.id%>" ng-show="formWhat">
        blbllblblbl
        </form>
</div>

This code will open all forms, but i need just on which is clicked, any idea?



via Chebli Mohamed

Javascript changes all image title attributes and not just the selected img

I am writing a Chrome Extension which allows people to report child sexual abuse images they find online. As soon as they report the image it should be replaced with another that is part of the extension. This all works well.

We also change the href of the image, the title and the alt. This is where things go wrong. The code is like this:

var imgs = document.getElementsByTagName("img");
  for(var idx = 0; idx < imgs.length; idx ++)
  {
    // request.greeting = an img src url
    if(imgs[idx].src == request.greeting) 
    {      
      var width = imgs[idx].getAttribute("width");
      var height = imgs[idx].height;
      var st = imgs[idx].style;

          imgs[idx].src = imgURL;  // Change the Image and set it's properties                   
          imgs[idx].href = "http:\\7ASecond.Net";
          imgs[idx].alt = "Removed by 7ASecond.Net";
          imgs[idx].title = "Removed by 7ASecond.Net";
          resizeImg(imgs[idx]);
         // imgs[idx].setAttribute("style", "width=" + width + "; height=" + height + ";");
        }
      }
    }

  });

What actually happens is that all images on the page have their title, and alt changed. Can you see the problem? Do you want to join the team to make this most needed extension? :D



via Chebli Mohamed

MEAN stack angular html tag inject not working

im new to angular so im trying something new to get used to it.

I use socket.io to get a list of images [car1...car5] and i want to dynamically inject them to the view.

in my html i have a that looks like this:

<div id="section" ng-bind-html="HTML">
    </div>

and in my core.js angular script i have:

var app = angular.module('test', []);

app.factory('socket', function () {
  var socket = io.connect('http://localhost:8080');
  return socket;
});

app.controller('TodoCtrl', function($scope, socket)
{
    socket.emit('images', {}); //send for a list of images
    socket.on('returnImages', function(data)
    {
        for(var i =1;i<=data.list.length;i++) 
        {
            $scope.HTML = '<img style="left:'+(i*50)+'px;" src="/images/'+data.list[i]+'"/>';
        }
        $scope.$digest();
    });
});

but this throws an error:

Error: [$sce:unsafe] http://ift.tt/1HJTijI etc

im following the docs so im not sure whats wrong and i tried including the angular-sanitize but I cant find the cdn link i keep getting a 404



via Chebli Mohamed

How to set an image to change source based off of two different radio buttons?

I'm starting to understand PHP pretty well, however, Javascript is still pretty new to me. I'm trying to change an image with Javascript, based on the selection of two radio buttons.

My radio buttons are as follows (one from the color set of radio buttons and one from the trim level set of radio buttons):

<input name="extcolor" type="radio" id="extcolor2'" value="Obsidian Blue Pearl" />
<input name="trimlevel" data-trim="exl" type="radio" value="2016 Honda Odyssey EX-L" />

I was able to get it to work with only one variable with this code:

<script type='text/javascript'>
$(document).ready(function(){
    $("input:radio[name=extcolor]").click(function() {
        var color = $(this).val();
        var image_name;
            image_name = ("/new-inventory-stock-images/<?=$VehicleYear?>/<?=$VehicleModel?>/configurations/base-cars/"+color+"_exl_34FRONT.png");
         $('#buildyourown').attr('src', image_name);
    });
});

<img src="default-image.png" name="buildyourown" id="buildyourown"> 

However, when I try to add a second variable, as is shown below, this is where the problem occurs. I can't seem to get javascript to read the data-trim data attribute in the trimlevel radio buttons and I don't think my functions are set up properly to work at the same time, but I can't for the life of me figure out how to set it up so both work. Can someone point me in the right direction?

<script type='text/javascript'>
$(document).ready(function(){
    $("input:radio[name=trimlevel]").click(function() {
        var trimlevel =$(this).attr(dataset.trim); 
        }

    $("input:radio[name=extcolor]").click(function() {
        var color = $(this).val();

        var image_name;
            image_name = ("/new-inventory-stock-images/<?=$VehicleYear?>/<?=$VehicleModel?>/configurations/base-cars/"+color+"_"+trimlevel+"_34FRONT.png");
         $('#buildyourown').attr('src', image_name);
    });
});

<img src="default-image.png" name="buildyourown" id="buildyourown"> 



via Chebli Mohamed

Flickity does not render the second image in the carousel

http://ift.tt/1PfihBD is a test of my website. I am attempting to add a flickity carousel, and for some reason it will not render the second image in the the divs. Here is the the carousel without all the the other html and css stuff. http://ift.tt/1N1Se1L

<div class="gallery js-flickity">
   <div class="gallery-cell">
      <img src="http://ift.tt/1N1Se1P" alt="art">
   </div>
   <div class="gallery-cell">
      <img src="http://ift.tt/1HAbDji" alt="stuff">
  </div>
  <div class="gallery-cell">
  </div>
  <div class="gallery-cell"></div>
  <div class="gallery-cell"></div>
</div>

CSS:

* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.gallery {
   padding: 50px 0px 0px 0px;

}

.gallery img {
  display: block;
  width: 100%;
  height:auto;
}

Heres proof the image links are good

art

stuff

Oh, and no jQuery.



via Chebli Mohamed

jQuery - Change CSS of one div that shares its class with other divs

I am trying to change the CSS of a single DIV that shares its class with other divs.

I have been trying looking around for a solution but nothing seems to work.

I am trying using the code below without results:

$(".singleOffer").click(function(){
    $(this).parent().find(".offerSocial").css({transform: "translateY(0%)", opacity: "1" });
});

HTML

<div id="pattern" class="pattern">
  <ul class="g">

<li class="singleOffer">
      <img class="offerImg" src="<?php echo $file ?>" alt="Product Name" />
      <div class="offerSocial">
          <a class="previewLink" target="_blank" href="<?php echo $file ?>" >DOWNLOAD</a>
          <label class="shareLabel">Share on</label>
          <div class="share-buttons">
              <button class="fbShare" type="button" onclick="window.open('<?php echo $file ?>', 'newwindow', 'width=500, height=500'); return false;">Facebook</button>
              <button class="twShare" type="button" onclick="window.open('<?php echo $file ?>', 'newwindow', 'width=500, height=500'); return false;">Twitter</button>
          </div>
      <div>
</li>

<li class="singleOffer">
      <img class="offerImg" src="<?php echo $file ?>" alt="Product Name" />
      <div class="offerSocial">
          <a class="previewLink" target="_blank" href="<?php echo $file ?>" >DOWNLOAD</a>
          <label class="shareLabel">Share on</label>
          <div class="share-buttons">
              <button class="fbShare" type="button" onclick="window.open('<?php echo $file ?>', 'newwindow', 'width=500, height=500'); return false;">Facebook</button>
              <button class="twShare" type="button" onclick="window.open('<?php echo $file ?>', 'newwindow', 'width=500, height=500'); return false;">Twitter</button>
          </div>
      <div>
</li>

.....

  </ul>
</div>



via Chebli Mohamed

How to change window title on a new popup window with custom height and width

Hi below is my code using a onclick with target="popup", how do I change the title of the new popup?

<a href="#" target="popup" 
  onclick="window.open('http://ift.tt/1UGj41N','popup','width=220,height=220,scrollbars=no,resizable=no'); return false;">Open new window</a>



via Chebli Mohamed

Space appearing on firefox, but not chrome?

folks.

Today,I decided to install firefox and test my navigation bar out on firefox instead of google chrome. Firefox shows a random space ontop while chrome doesn't. Anyone know what the problem is and how to fix it?

This is what firefox looks like compare to chrome.(Sorry for the bad quality, I resized it bad.)

http://ift.tt/1UGj5mn

If it matters, this is the code i'm using:

<html>

<head>
<title>Blitz</title>

<style>
body{
margin: 0px;
padding:0px;
}

.Blitz{
background-color:#2DDEDE;
padding:0px;
margin:0px;
border-color:black;
}

.Navigationbar{
height:40px;
width:500px;
background:#a7e8ee;
border:none;
}


.Navigationbar li{
display:inline;

}


.Navigationbar a{
color:black;
text-decoration:none;
}
</style>

</head>

<body>


<div class="Blitz">
<h1><center>Blitz</center></h1>
<ul>
<div class="Navigationbar">
<li><a href="#">Home</a></li>
<li><a href="#">Forums</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Featured</a></li>
<li><a href="#">Sign up</a></li>
<li><a href="#">Login</a></li>
</ul>
</div>
</div>

<div class="information">
<!--Information about the site here. Pictures to go with that-->

</div>

</body>

</html>



via Chebli Mohamed

How can I paginate the thumbnails of this jQuery image slider?

Link to code below. n.b. this is quite messy as I have dropped it in from the site.

http://ift.tt/1h8jtM5

I have an image slider, with the 'active' image on the left and thumbnails for all images on the right.

The thumbnails are automatically generated based on the images in the #slider div.

You click one of the thumbnails and the active image changes.

What I need to do at request of my client, is paginate these thumbnails to a maximum of 14 items.

After item 14, will be a 'next' link, which changes to show the remaining thumbnails.

There will not be more than 28 thumbnails, if this helps. It is fine to have a 'next' link on both the 1st and 2nd page of thumbnails - no requirement for a 'previous' link.

Thank you! This is for a important project so any help much appreciated.

Important code below but please see js fiddle above for full example.

<div class="lookbook__image">
<div id="slider1">
<img src="xxxx.jpg">
... and more images
</div>
</div>

<div class="lookbook__thumbs">
<ul class="lookbook__thumbs__list">
</ul>
</div>
</div>
<script src="http://ift.tt/1UGj41L"></script>

<script>
$(document).ready(function(){
$('#slider1').cycle({
fx: 'fade', // Here you can change the effect
speed: 'slow', 
timeout: 0,
next: '#next', 
prev: '#prev',
pager: '.lookbook__thumbs__list',
pagerAnchorBuilder: function(idx, slide) { 
return '<li><a href="#"><img src="' + slide.src + '" /></a></li>'; 
} 
});
});
</script>



via Chebli Mohamed

Background image for media screen not displaying whole image

I'm trying to make my site responsive and I cannot get my pages background image that covers 85% of the screen to display the entire image. It just shows a very small portion of it. What am I doing wrong? If it helps, my site is sundayfundayleague.com .

I'm attempting to do this..

.indexgraypage {
    width: 100%;
    left: 0;
    right: 0;
    min-height: 100%;
}
.homeimg {
    background-image: url("/images/bright_lights_smallest.jpg");
    width: 80%;
    background-size: cover;
    background-position: center;
    height: 100%;
    margin: auto;
    position: absolute;
    margin-right: 10%;
    margin-left: 10%;
}



via Chebli Mohamed

Add a filter to an HTML document

Alright, so i have a very simple HTML page which includes a section:

<p class="gallery">
<a href="www.example.com"><img src="example.jpg"></a>
<a href="www.example.com"><img src="example.jpg"></a>
<a href="www.example.com"><img src="example.jpg"></a>
<a href="www.example.com"><img src="example.jpg"></a>
<a href="www.example.com"><img src="example.jpg"></a>
<a href="www.example.com"><img src="example.jpg"></a>
</p>

We want to upgrade this page so that we can put a selector at the top (probably checkboxes) with a list of tags. Each image would have multiple tags attached to it, and when one or more checkboxes are selected, only images containing all those tags are shown.

So, for example, Image 1 has "John" and "Steve" as tags,Image 2 has "Joe" and "Jack" and Image 3 has "John" and "Jack". I select the checkbox for "John" and press the filter button, and Both images 1 and 3 stay, but 2 is hidden. I then select "Jack" as well and filter again and image 1 vanishes.

What's the best or easiest way to modify this to achieve this result?

Edit: For the record, I'm not expecting someone to hand me a finished page, but i've found, through research, three or four TOTALLY different methods of filtering out lines like this but none of them i've seen so far could do quite the right thing. For example, I found this javascript combined with data-filter="Tag" and id="tag" but i have no idea if i can make it sort on multiple tags at once or how.

var posts = $('.post');
posts.hide();

$("#category li a").click(function () {

    var customType = $(this).data('filter');
    console.log(customType);
    console.log(posts.length);

    posts.hide();
    $("#" + customType).show();
});



via Chebli Mohamed

Certain css elements aren't scaling properly

I was wondering how I can correct some of these elements from moving into funny positions when the browser window is resized. I've managed to make the nav bar scale by using width: 100%; height: auto; However I'd like it so it scales neatly. Also I've learnt that using % rather than px seems to scale most things automatically. However with some elements on my site such as the team speak and server IP buttons at the top it is really hard to position them with %. As you can see from this animation of me resizing the window you can see what I mean about the nav bar and the buttons at the top. They scale but they move into funny positions, that's rather untidy. There are other elements that also move I'll provide the css for all the elements that move where they shouldn't below. Also if it helps this is my site so you can see where these elements belong.

Here is the css code for nav bar:

* {margin: 0px;
   padding: 0px;}

#nav_bar {background-color: #212121;
          height: 45px;
          text-align: center;
          position: relative;
          width: 100%;
          height: auto;}

#nav_bar ul {padding: 0px;}

#nav_bar > ul > li {display: inline-block;}

#nav_bar ul > li > a {color: white;
                      display: block;
                      text-decoration: none;
                      font-weight: normal;
                      padding-left: 25px;
                      padding-right: 25px;
                      line-height: 45px;
                      transition: all 0.5s ease;}

#nav_bar ul li ul {display: none;
                   list-style: none;
                   position: absolute;
                   background: white;
                   margin-left: 0px;
                   border-radius: 0px 0px 5px 5px;
                   box-shadow: 0px 1.5px 2px 0px;
                   border-left: 1px solid #BDBDBD;
                   border-right: 1px solid #BDBDBD;
                   border-bottom: 1px solid #BDBDBD;
                   color: #BDBDBD;
                   text-align: left;
                   z-index: 1;}

#nav_bar ul li a.active-page {background-color: #C62828;}

#nav_bar ul li:hover ul li a {line-height: 2em;}

#nav_bar ul li a:hover {background: #C62828;
                        transition: all 0.5s ease;}

#nav_bar ul li:hover ul {display: block;}

#nav_bar ul li ul li a {color: #000000;
                        display: block;}

#nav_bar ul li ul li a:hover {background: #1565C0;
                              color: white;
                              transition: all 0.5s ease;}

Here is the css code for the top buttons:

#logo {position: relative;
       top: -70px;
       text-align: center;}

#ip_box {width: 210px;
         height: 43px;
         background: #212121;                 
         color: white;
         font-size: 15px;
         top: 0;
         left: 150px;
         position: absolute;}

#ip_text {bottom: 85px;
          top: 4px;
          left: 138px;        
          color: white;
          position: absolute;}

#teamspeak_box {display: block;
                width: 159px;
                height: 43px;
                background: #212121;
                position: absolute;
                top: 0;
                right: 154px;
                transition: all 0.5s ease;}

#teamspeak_box:hover {/*border-bottom: 4px solid #C62828;*/
                      background: #313131;
                      transition: all 0.5s ease;}

#teamspeak_box a {display: block;
                  height: 43px;}

#teamspeak_box_2 {display: block;
                  width: 43px;
                  height: 43px;
                  background:#313131;
                  position: absolute;
                  left: 0;
                  top: 0;}

#teamspeak_image {display: block;
                  position: absolute;
                  top: 5px;
                  left: 5px;}

#teamspeak_text {display: block;
                 color: white;
                 position: absolute;
                 top: 14px;
                 right: 10px;
                 font-family: 'Roboto', sans-serif;}

And lastly the css for the social media buttons at the bottom:

#social_media_youtube {float: left;
                       position: relative;
                       bottom: 12px;
                       left: 675px;}

#social_media_twitch  {float: left;
                       position: relative;
                       bottom: 10px;
                       left: 575px;}

#social_media_twitter {float: right;
                       position: relative;
                       bottom: 20px;
                       right: 675px;}

#social_media_facebook {float: right;
                        position: relative;
                        bottom: 13px;
                        right: 575px;}



via Chebli Mohamed

Javascript 'Window.open' causing hover at element which is not hoverred by mouse pointer at Google Chrome

I am doing an application which the user receive a list of items to choose, when the user moves the mouse a DIV:Hover class works backgrounding the color of the div, and when he clicks at one div to select it an ONCLICK function marks the clicked div and redirect to a website( _blank ), perfect, but when you go back to this page there is two div selected, the div user has clicked and another one , if the user moves the mouse, even if a little the second div backs to normal.

What i want is go back to page and only the div clicked is marked.

It only happens at Google Chrome

Jsfiddle ----> http://ift.tt/1WnA26Q

Print Screen --> http://ift.tt/1WnA52g

Is it possible to solve and do not marks a second DIV ?

If I do not redirect to a website, it work normally, but i need to redirect =(



via Chebli Mohamed

Google charts HTML tooltip for Sankey

enter image description hereI am using Google charts to display a Sankey diagram on my webpage. On clicking each link I would like the page to redirect to another page.

The problem is the 'select' handler in Sankey is not working, and is a known issue. To overcome this I added a HTML tool-tip to my links and gave a button, such that if user clicks the button then they are redirected to next page.

The problem with this solution is that I am unable to control where the tool-tip appears, so for certain links the tool-tip appears above the link. In this case the user can never reach the button because the tool-tip disappears the moment they move away from the link.

Can you please suggest a solution to either the original problem, or this tool-tip side effect?



via Chebli Mohamed

Where is the best place to store supporting JSON on dynamic AJAX load?

Scenario: I have an HTML page with a dynamic modal dialog. Links on the page open the dialog, but with different contents according to the clicked link. Dialog contents are loaded using an AJAX request, and include only the required HTML - no html or head tags, for example.

In the dialog, there is a 'Status' display, and a couple of date pickers (e.g. 'Activated' and 'Removed'). As the dates change, the Status should update to show the current status according to the dates. That I can do, no worries.

In the application I have an enum for the Status, and I want the JavaScript in this dialog to make use of the same list of statuses as the server-side app. I figure the MVC should generate some JSON, listing the enum entries, for example:

{ "active": "Active", "removed", "Removed" }

Now the question! Where's the best place to put this JSON in the page, if it is loaded with the modal contents? Here are some options I've considered:

  • I could store it in a var in the head, but I don't need it to appear in every page in the application.
  • I could insert it into the head, or add it to the document element, when the modal is loaded, using a JS function called by the modal contents.
  • I could store it in the data tag of the Status display element.


via Chebli Mohamed

display:none not working in popup

I am trying to display this popup on JSGCL website. It does display the popup but it neither displays the text of the popup nor close the popup on pressing close.

HTML:

<div id="popup">
    <div >
        <h1>JamaPunji</h1>
        <p><a href="http://ift.tt/1h8fFKW" target="_blank">Click here</a> to get details.</p>
       <a href="#" id="close_popup">Close</a>
</div>

CSS:

#popup{
    position: absolute;
    background: #004990;
    top: 45%;
    left: 45%;
    width: 300px;
    height: 200px;
    /* border: 1px solid #000; */
    border-radius: 5px;
    padding: 5px;
    color: #fff;
    z-index:9999;
} 
#close_popup {
    color:#FFF;
    position:absolute;
    right:0px;
    top:0px;
}
#popup h1,#popup p, #popup a{
    text-align:center;
    z-index:9999;
}
#popup a{
    color:#F47B20;
      z-index:9999;
}

JavaScript:

$(document).ready(function() 
 {    $("#popup").css("display", "block");
  });

  $("#close_popup").click(function(){
    $("#popup").css("display", "none");
  }); 



via Chebli Mohamed