Click here to Skip to main content
15,893,161 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerQuestion Pin
Richard Deeming18-Aug-16 7:27
mveRichard Deeming18-Aug-16 7:27 
Questionjavacript alert message Pin
classy_dog17-Aug-16 8:22
classy_dog17-Aug-16 8:22 
AnswerRe: javacript alert message Pin
Richard MacCutchan18-Aug-16 2:30
mveRichard MacCutchan18-Aug-16 2:30 
AnswerRe: javacript alert message Pin
Karthik_Mahalingam20-Aug-16 18:16
professionalKarthik_Mahalingam20-Aug-16 18:16 
AnswerRe: javacript alert message Pin
Harpreet05Kaur26-Sep-16 1:54
Harpreet05Kaur26-Sep-16 1:54 
QuestionOnmouseover javascript 'JavaScript runtime error: 'LabelHover' is undefined' Pin
Bootzilla3317-Aug-16 7:27
Bootzilla3317-Aug-16 7:27 
AnswerRe: Onmouseover javascript 'JavaScript runtime error: 'LabelHover' is undefined' Pin
Karthik_Mahalingam20-Aug-16 18:21
professionalKarthik_Mahalingam20-Aug-16 18:21 
QuestionMath question using JQuery and Javascript with a horizontal sliding row Pin
jkirkerx12-Aug-16 10:08
professionaljkirkerx12-Aug-16 10:08 
Oh I'm terrible at math this summer.

I have this horizontal row, filled with items that overflow.
I have these radio buttons under them, that show the page number.

I'm trying to make it where your on a mobile phone, and you slide left, the correct radio button is selected.

I have a left, remaining left, and a total of pixels
I just can't figure out the math to say, this is in the range of 1, 2, 3 and so on.

I wrote some code
function run_touch_pagination() {

    var $e_sliderFrame                  = $(".slider ul"),
        $e_sliderSlide                  = $(".slider-slide"),
        _sliderSlide_width              = $e_sliderSlide.css('width'),
        _sliderFrame_maxWidth           = $e_sliderFrame.width(),
        _sliderSlide_count              = $e_sliderSlide.length,
        _sliderSlide_left               = 0;
        _sliderSlide_index              = 0,
        _sliderSlide_pageCount          = 0;

    // What is the current left of the UL Container
    $(".slider ul").filter(function () {
        // 23 is the margin or padding set in the CSS file
        // So we are removing 23 to get 0 or zero out the scale
        // Turn the negative number into a positive number
        _sliderSlide_left = Math.abs($(this).position().left - 23);<br />
    });

    // Calculate the Page Count
    _sliderSlide_pageCount = Math.ceil(_sliderSlide_count / sliderSlides);

    // Calculate the what radio button should be highlighted
    // The start number is 23 because of the margin in CSS
    // _sliderSlide_width is the width of a single slide

    var x = _sliderSlide_left;
    var y = _sliderSlide_count * parseInt(_sliderSlide_width);
    var z = y - _sliderSlide_left;

    $("#slideLeft").val(x + ', ' + z + ', = ' + y);
    $("#slideNumber").val();

}

Now I know looking at the function above won't tell you much, and my description as well
So this is a link to the program.
Program Demostration[^]

You have to reduce the size of your browser so just 4 items show. The frame will appear and turn gray.
There are 2 textboxes on the bottom of the frame under the radio buttons,
Left Box, is x, z and y, the right box is suppose to be the radio button index.

I'm wondering if this slider program is worth it. but that's what people want when they shop.
AnswerIt's closer now, needs refinement Pin
jkirkerx14-Aug-16 10:26
professionaljkirkerx14-Aug-16 10:26 
QuestionMeasuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
jkirkerx11-Aug-16 8:38
professionaljkirkerx11-Aug-16 8:38 
AnswerRe: Measuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
jkirkerx11-Aug-16 11:14
professionaljkirkerx11-Aug-16 11:14 
AnswerRe: Measuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
Nathan Minier12-Aug-16 1:39
professionalNathan Minier12-Aug-16 1:39 
GeneralRe: Measuring how many li are in a ul that are visible in a horizontal sliding row of items Pin
jkirkerx12-Aug-16 6:44
professionaljkirkerx12-Aug-16 6:44 
QuestionHow to create array from existing array Pin
Member 126783159-Aug-16 17:00
Member 126783159-Aug-16 17:00 
AnswerRe: How to create array from existing array Pin
Richard MacCutchan9-Aug-16 21:06
mveRichard MacCutchan9-Aug-16 21:06 
AnswerRe: How to create array from existing array Pin
Karthik_Mahalingam20-Aug-16 18:26
professionalKarthik_Mahalingam20-Aug-16 18:26 
QuestionJS Object Remove Duplicates Pin
Member 126766088-Aug-16 19:49
Member 126766088-Aug-16 19:49 
AnswerRe: JS Object Remove Duplicates Pin
W Balboos, GHB9-Aug-16 5:06
W Balboos, GHB9-Aug-16 5:06 
AnswerRe: JS Object Remove Duplicates Pin
Beginner Luck14-Aug-16 19:59
professionalBeginner Luck14-Aug-16 19:59 
QuestionAdd query columns to output (see code) Pin
Stavros McGillicuddy7-Aug-16 11:15
Stavros McGillicuddy7-Aug-16 11:15 
AnswerRe: Add query columns to output (see code) Pin
Nathan Minier8-Aug-16 1:30
professionalNathan Minier8-Aug-16 1:30 
QuestionUnexpected Identifier error Pin
Stavros McGillicuddy6-Aug-16 11:02
Stavros McGillicuddy6-Aug-16 11:02 
QuestionRe: Unexpected Identifier error Pin
Richard Deeming8-Aug-16 1:38
mveRichard Deeming8-Aug-16 1:38 
Questionchange in cell content of salary or bonus or deduction in table cells automatically affect in total Pin
ahmed_sa30-Jul-16 6:39
ahmed_sa30-Jul-16 6:39 
Questionget the value of row before changing in table if cancel click Pin
ahmed_sa25-Jul-16 7:13
ahmed_sa25-Jul-16 7:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.